Maurizio-Ciullo

Bot Trendwide Tradestation

May 22nd, 2022 (edited)
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.                                                 Bot Trendwide Tradestation
  2.  
  3. //Inputs
  4. input:
  5. maInputSlow(81),
  6. maInputFast(15),
  7. maMinDiff(15);
  8.  
  9. // Dichiarazione Variabili
  10. vars:
  11. maSlow(0),
  12. maFast(0),
  13. chiusura_minima(0),
  14. condEntryLong(false),
  15. condExitLong(false),
  16. condEntryShort(false),
  17. condExitShort(false);
  18.  
  19.  
  20.  
  21. // Assegnazione Variabili
  22. maSlow = xaverage(close, maInputSlow);
  23. maFast = xaverage(close, maInputFast);
  24.  
  25. // condizione entrata/uscita Long e Short
  26. condEntryLong = close > maSlow and (maFast - maSlow) > maMinDiff;
  27. condExitLong = maFast cross under maSlow;
  28.  
  29. condEntryShort = close cross under maSlow and (maSlow - maFast) > maMinDiff;
  30. condExitShort = close cross over maFast;
  31.  
  32.  
  33. //Entrata Long
  34.  
  35. if condEntryLong Then
  36.     Buy("Long") 1 contracts Next Bar at market;
  37.    
  38. // Uscita Long
  39.      
  40. if condExitLong then
  41.     Sell("Chiusura Long") from entry("Long") Next Bar at market;
  42.    
  43. //Entrata short
  44.  
  45. if condEntryShort Then
  46.     Sellshort("Short") 1 contracts Next Bar at market;
  47.    
  48. // Uscita Short
  49.      
  50. if condExitShort then
  51.     Buytocover("Chiusura Short") from entry("Short") Next Bar at market;
Add Comment
Please, Sign In to add comment