Advertisement
Maurizio-Ciullo

Indicatore Z-Score

Aug 26th, 2023
921
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Inputs: ThresholdValue(0);
  2. Variables: EntryPrice(0), ExitPrice(0), Difference(0), Result(0);
  3.  
  4. condition1 = close > Average(close, 21);
  5. condition2 = close < Average(close, 21);
  6.  
  7. If condition1 and EntryPrice=0 Then
  8.     EntryPrice = Close
  9. else If condition2 Then Begin
  10.     ExitPrice = Close;  
  11.     if EntryPrice <> 0 then
  12.         Difference = ExitPrice - EntryPrice;
  13.         EntryPrice =0;
  14.             ExitPrice =0;
  15.    
  16. End;
  17.  
  18. If Difference >= ThresholdValue Then
  19.         Result = 1
  20.     Else
  21.         Result = -1;
  22. Plot1(Result , "Risultato");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement