Advertisement
Maurizio-Ciullo

Funzione Print File Txt

Feb 18th, 2023
621
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  
  3.                                               // Funzione Print File Txt //
  4.                                              
  5.                                 // Caricare sia la funzione che la Strategia sullo Strategy !!! //
  6.                                 // Per Fare Il Print Della Funzione Bisogna Prima Creare Una Strategia //
  7.                    
  8. // https://markplex.com/free-tutorials/tradestation-easylanguage-quicktips/quick-tip-15-format-date-time/
  9. // https://www.youtube.com/watch?v=49Ta3jYKtxM
  10.  
  11. //---------------------------------------------------------------------------------------------------------------------------------------//
  12.                             // Esempio della funzione per stampare sia su file .txt si sui log una strategia richiamando la funzione //
  13.  
  14. Var: MarkP(0);
  15.  
  16. MarkP = Marketposition;
  17.  
  18. // Clear the print log when the strategy first applyed or refreshed
  19. Once Clearprintlog;
  20.  
  21. If MarkP <> MarkP[1] and MarkP[1] <> 0 then Begin
  22.         //Print(Getstrategyname, ", ", Symbol, ", ", Formatdate("dd/MM/yy", ElDateToDateTime( Date )), ", ", BarDateTime.Format( "%H%M.%S" ), ", ", Open, ", ", High, ", ", Low, ", ", Close, ", ", Volume, ", ", Positionprofit(1)); // or yy/MM/dd
  23.         Print(File("C:\Users\morris\Desktop\PrintEasyLanguage.txt"), Getstrategyname, ", ", Symbol, ", ", Formatdate("dd/MM/yy", ElDateToDateTime( Date )), ", ", BarDateTime.Format( "%H%M.%S" ), ", ", Open, ", ", High, ", ", Low, ", ", Close, ", ", Volume, ", ", Positionprofit(1)); // or yy/MM/dd
  24. End;
  25.  
  26. FunzionePrintFileTxt = 0; // Nella strategia ricopiare: FunzionePrintFileTxt = 0; alla fine del codice !!!.
  27.  
  28.  
  29. //---------------------------------------------------------------------------------------------------------------------------------------//
  30.                                    // Altro modo per dirgli che eravamo long e che siamo usciti dal trade //
  31.                                          // LONG IF MP = 1 and ( MP[1] <> 1 or TT <> TT[1] ) //
  32.                                         // SHORT IF MP = -1 and ( MP[1] <> -1 or TT <> TT[1] ) //
  33.  
  34. {Var:  MP(0), TT(0);
  35. MP = Marketposition;
  36. TT = Totaltrades;}
  37.  
  38. // Clear the print log when the strategy first applyed or refreshed
  39. //Once Clearprintlog;
  40.  
  41. // We were in a long position and we were not in a position in the last bar OR a trade has been completed
  42. //IF MP = 1 and ( MP[1] <> 1 or TT <> TT[1] ) Then
  43.     //Print(File("C:\Users\morris\Desktop\PrintProfittoStrategy.txt"), Getstrategyname, ", ", Symbol, ", ", Formatdate("dd/MM/yy", ElDateToDateTime( Date )), ", ", BarDateTime.Format( "%H%M.%S" ), ", ", Open, ", ", High, ", ", Low, ", ", Close, ", ", Volume, ", ", Positionprofit(1)); // or yy/MM/dd }        
  44.     //Questo serve a stampare i log e non a fare il print di un file
  45.     //Print(Getstrategyname, ", ", Symbol, ", ", Formatdate("dd/MM/yy", ElDateToDateTime( Date )), ", ", BarDateTime.Format( "%H%M.%S" ), ", ", Open, ", ", High, ", ", Low, ", ", Close, ", ", Volume, ", ", Positionprofit(1), ", ", MP) ; // or yy/MM/dd        
  46.  
  47.    
  48. // We were in a short position and we were not in a position in the last bar OR a trade has been completed
  49. //IF MP = -1 and ( MP[1] <> -1 or TT <> TT[1] ) Then
  50.     //Print(File("C:\Users\morris\Desktop\PrintProfittoStrategy.txt"), Getstrategyname, ", ", Symbol, ", ", Formatdate("dd/MM/yy", ElDateToDateTime( Date )), ", ", BarDateTime.Format( "%H%M.%S" ), ", ", Open, ", ", High, ", ", Low, ", ", Close, ", ", Volume, ", ", Positionprofit(1)); // or yy/MM/dd }        
  51.     //Questo serve a stampare i log e non a fare il print di un file
  52.     //Print(Getstrategyname, ", ", Symbol, ", ", Formatdate("dd/MM/yy", ElDateToDateTime( Date )), ", ", BarDateTime.Format( "%H%M.%S" ), ", ", Open, ", ", High, ", ", Low, ", ", Close, ", ", Volume, ", ", Positionprofit(1), ", ", MP) ; // or yy/MM/dd        
  53.  
  54. //FunzionePrintFileTxt = 0; // Nella strategia ricopiare: FunzionePrintFileTxt = 0; alla fine del codice !!!.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement