Advertisement
Maurizio-Ciullo

Indicatore Test Hours Buy Sell

Dec 20th, 2022 (edited)
1,701
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.                                             // Indicatore Test Hours Buy Sell //
  2.                             // Compra e vende alla candela successiva ad ogni candela in base all'orario scelto //
  3.  
  4.  
  5.  
  6. // Unger Miglior Ora Per Andare A Mercato Sull'Orario
  7. // Ottimizzazione da 0 a 23 o da 0 a ... usa il plot sotto per vedere le sessioni di mercato quando il mercato è aperto
  8. // Mettere input testphase a 1 per solo long long, input testphase a 2 per solo short
  9. // Timeframe Orarion
  10. // Se Ottimizzati Insieme I Risultati Cambiano Del Farlo Separatamente Per Poi Unirli Alla Fine
  11.  
  12.         // Attenzione l'acquisto è alla candela successiva quindi anche se ora 0 = mezzanotte, entrerà all'ora 1 etc... !!! //
  13.  
  14.  
  15.  
  16. {Input: InitialCapital(100000);
  17. Input: percent_risk(100);
  18. input: input_stop_loss(11);}
  19. Input: testphase(1);
  20. Input: mycounter(0);
  21.  
  22. Variable:
  23. risk(0), nr_share(0), stop_loss(0), mycount(0);
  24.    
  25.  
  26.  
  27.  //Money menagment
  28. {risk = percent_risk/100;
  29. nr_share = floor((InitialCapital + NetProfit) * risk) / close;
  30. stop_loss=((((InitialCapital + NetProfit) * risk)/100) * input_stop_loss);}
  31.  
  32.  
  33.  
  34. //////////////          //////////////          //////////////
  35. If Time = 0 then mycount = 0 else mycount = mycount + 1;
  36.  
  37.  
  38. If testphase = 1 then begin  // Solo Long
  39.     if mycounter = mycount then buy next bar at market;
  40.     if marketposition = 1 then sell next bar at market;
  41. end;
  42.  
  43. If testphase = 2 then begin // Solo Short
  44.     if mycounter = mycount then sellshort next bar at market;
  45.     if marketposition = -1 then buytocover next bar at market;
  46. end;
  47. //////////////          //////////////          //////////////
  48.  
  49.  
  50.                                 // Creare un indicatore per plottare le ore //
  51. {var:
  52. mycount(0);
  53.  
  54. If Time = 0 then mycount = 0 else mycount = mycount + 1;
  55. plot1(Time);
  56. plot2(mycount)}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement