Advertisement
Maurizio-Ciullo

Indicatore Session Last Bar Criptovalute

Aug 27th, 2022
1,186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.                                                 //  Indicatore Session Last Bar Criptovalute Tradestation  //
  2.                                      // Assegna ad ogni ora un conteggio di barra da 0 a 23 su grafico intraday  //                                            
  3.                                                
  4.                            
  5.  
  6.            // Questo Sistema Conta Le barre Perchè E' Più Facile Fargli Capire Determinate Ore Quando Cambia Giornata //
  7.      // Questo conteggio sostituisce il SessionLastBar Di Multicharts perchè le criptovalute non hanno sessione su tradestation impostato su exchange //
  8.                                 // Il conteggio delle barre parte da 0 ore 00:00 per avanzare di uno ad ogni barra successiva //
  9.    
  10.  
  11.  
  12. // Questo plot verifica l'ora, il giorno della settimana che va da 0 a 6 e il mycount che conta le candele a partire da mezzanotte per poi riazzerandole ad ogni mezzanotte.                           
  13. // Dayofweek(Date) Per la settimana borsistica va da 0 a 5 Per le criptovalute da 0 a 6.               
  14. // Mycount va da  da 0 a 23 su timeframe orario.
  15.  
  16.  
  17.  
  18. Input: testphase(0);
  19. Input: mycounter(0);
  20. Input: MyStartTimeL(11), MyEndTimeL(0);
  21. Input: MyStartTimeS(1), MyEndTimeS(10);
  22.  
  23. Var : mycount(0);
  24.  
  25. If Time = 0 then mycount = 0 else mycount = mycount + 1;
  26.  
  27.  
  28. If testphase = 1 then begin  // Solo Long
  29.     if mycounter = mycount then buy next bar at market;
  30.     if marketposition = 1 then sell next bar at market;
  31. end;
  32.  
  33. If testphase = 2 then begin // Solo Short
  34.     if mycounter = mycount then sellshort next bar at market;
  35.     if marketposition = -1 then buytocover next bar at market;
  36. end;
  37.  
  38.  
  39.  
  40.  
  41. If testphase = 0 then begin // Buy Long Entry Exit My Time Long
  42.     if mycount = MyStartTimeL then buy next bar at market;
  43.     if marketposition = 1 and mycount = MyEndTimeL then sell next bar at market;
  44. end;
  45.  
  46. If testphase = 0 then begin // Sell Short Entry Exit My Time Short
  47.     if mycount = MyStartTimeS then sellshort next bar at market;
  48.     if marketposition = -1 and mycount = MyEndTimeS then buytocover next bar at market;
  49. end;
  50.  
  51. {plot1(time);             // 00:00 = 0,00. 01:00 = 100.00. 23:00 = 2300.00
  52. //plot2(count);          // 24 = 00:00 Mycount va ha un range da 0 a 23
  53. plot3(Dayofweek(Date));  // Domenica = 0 Sabato è 6
  54. plot4(mycount);}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement