// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
// The system will cancel all pending orders and close all positions at 0:00. No new ones will be allowed until after the "FLATBEFORE" time.
DEFPARAM FLATBEFORE = 081500
// Cancel all pending orders and close all positions at the "FLATAFTER" time
DEFPARAM FLATAFTER = 161500
TIMEFRAME (5 minutes)
once TradeCount = 0
// Conditions to enter long positions
indicator1 = ExponentialAverage[10](close)
indicator2 = ExponentialAverage[21](close)
indicator3 = ExponentialAverage[50](close)
c1 = (indicator1 > indicator2) AND (indicator2 > indicator3)
c2 = (indicator1[5] > indicator2[5]) AND (indicator2[5] > indicator3[5])
c3 = (indicator1[10] > indicator2[10]) AND (indicator2[10] > indicator3[10])
indicator16 = LinearRegressionSlope[18](close)
c12 = (indicator16 > longLRSmin)
indicator17 = LinearRegressionSlope[5](close)
c13 = (indicator17 > longLRSmax)
IF c1 AND c2 AND c3 AND c12 AND c13 then
BUY 1 PERPOINT AT MARKET
TradeCount = TradeCount+1
ENDIF
// Stops and targets
SET STOP LOSS 50
IF TradeCount = 1 then
SET TARGET PROFIT 10
Endif
IF TradeCount = 2 then
SET TARGET PROFIT 20
Endif
IF TradeCount = 3 then
SET TARGET PROFIT 30
Endif
IF TradeCount = 4 then
TradeCount = 0
Endif