Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {{ INIZIO INDICATORE }}
- Inputs: ThresholdValue(0), zscore(0);
- Variables: EntryPrice(0), ExitPrice(0), Difference(0), Result(0);
- condition1 = close > Average(close, 21);
- condition2 = close < Average(close, 21);
- If condition1 and EntryPrice = 0 Then
- EntryPrice = Close
- else If condition2 Then Begin
- ExitPrice = Close;
- if EntryPrice <> 0 then
- begin
- Difference = ExitPrice - EntryPrice;
- EntryPrice = 0;
- ExitPrice = 0;
- end;
- End;
- {{ FINE INDICATORE }}
- if zscore = 1 then
- begin
- if close > Average(close, 21) and Difference < 0 then
- buy next bar at market
- else
- sell next bar at market;
- end
- else
- begin
- if close > Average(close, 21) then
- buy next bar at market
- else if close < Average(close, 21) then
- sell next bar at market;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement