Advertisement
Guest User

Untitled

a guest
Apr 26th, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.57 KB | None | 0 0
  1. // BUY CONDITIONS
  2. // Entry for a bull trade, exit for bear trade
  3.  
  4. // simple conditions for example, using long TF
  5.  
  6. // Look for a low above the lines (candle entirely out of the band)
  7. priceOverNegStDev1 = crossover(low, longDevLineBelow1)    // Negative Standard Deviation (i.e. below the mean)
  8. priceOverNegGolden = crossover(low, longDevLineBelow2)    // Negative Golden Deviation
  9.  
  10. // Trigger a bull signal when conditions are met
  11. bullSignal = priceOverNegStDev1 or priceOverNegGolden
  12.  
  13.  
  14. // SELL CONDITIONS
  15. // Exit for bull, entry for bear
  16.  
  17. // simple conditions for example, using long TF
  18.  
  19. // Look for a high below the bands
  20. priceOverPosStDev1 = crossunder(high, longDevLineAbove1)    // Positive Standard Deviation (i.e. above the mean)
  21. priceOverPosGolden = crossunder(high, longDevLineAbove2)    // Positive Golden Deviation
  22.  
  23. // Trigger a bear signal when conditions are met
  24. bearSignal = priceOverPosStDev1 or priceOverPosGolden
  25.  
  26.  
  27.  
  28. // ________________________
  29. // ______ EXECUTION ______
  30.  
  31. // BULL TRADE
  32. strategy.entry( "BULL", strategy.long, when=( bullSignal and isTimeRange ) )
  33. strategy.close( "BULL",                when=( bearSignal and isTimeRange ) )
  34.  
  35. // BEAR TRADE
  36. //strategy.entry( "BEAR", strategy.short, when=( bearSignal and isTimeRange ) )
  37. //strategy.close( "BEAR",                 when=( bullSignal and isTimeRange ) )
  38.  
  39.  
  40.  
  41. //                                  End of STRATEGY
  42. // *****************************************************************************
  43. // -----------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement