System is not putting out any stoporders at all. No signs of rejections either
Line 21 computes the average of the daily range for the last 20 bars, but they aremost likely always the same, as they are NOT daily bars, but those of the TF you have chosen. On a 5-minute TF the last 20 bars are likely to share the same daily range.
I tested it on DAX, 5 and 10-minute TF and it enters several trades. On 1-minute TF, it opended only 1 trade using 50K.
Check if line 21 is correct or not, according to your idea.
I see. What i want is the code to calculate average daily range. Could you help me change it so it calculates for daily bars? Instead of just bars? I use the system on manual trading so it should produce almost one trade everyday.
i use the code on a 1 min and 3 min tf. Had not taken any trades for something like 18 days.
roberto, if you try it on dow jones, May 6th is the last day it takes a trade. Ive tried to change line 21 everything from 5-20 days. Stil exactly same results no matter what
Try using this modified version:
//-------------------------------------------------------------------------
// Main code : ryd range box 1-2 min US30 DOW
//-------------------------------------------------------------------------
DEFPARAM CumulateOrders = FALSE
Timeframe(default)
ONCE PL = 130.0
ONCE SL = 60.0
ONCE t = 50.0
ONCE tS = 50.0
ONCE x = 40.0
ONCE y = 1.0
IF Not OnMarket THEN
MyExit = 0
ELSE
c1 = 0
ENDIF
Timeframe(Daily,UpdateOnClose)
// ADR Average Daily Range
MyADR = average[20,0](range)
//
Timeframe(default)
IF (Time = 000000) OR ((Time > 000000) AND (Time < Time[1])) THEN
MyHI = high
MyLO = low
c1 = 0
ENDIF
IF Time <= 142900 THEN
MyHI = max(MyHI,high)
MyLO = min(MyLO,low)
MyRange = MyHI - MyLO
c1 = ((MyRange / MyADR) * 100) < x //75
ENDIF
IF Time >= 142900 AND c1 THEN
BUY 0.2 Contract AT MyHI + y * pipsize STOP
SELLSHORT 0.2 Contract AT MyLO - y * pipsize STOP
SET TARGET pPROFIT PL //40
SET STOP pLOSS SL //80
ENDIF
IF MyExit = 0 THEN
IF (LongOnMarket AND (close - TradePrice) >= t * pipsize) OR (ShortOnMarket AND (TradePrice - close) >= tS * pipsize) THEN //27.5 37.5
MyExit = TradePrice
ENDIF
ENDIF
IF MyExit > 0 THEN
SELL AT MyExit STOP
EXITSHORT AT MyExit STOP
ENDIF
//GraphOnPrice TradePrice coloured(0,0,255,255)
//GraphOnPrice MyHI coloured(0,128,0,200)
//GraphOnPrice MyLO coloured(255,0,0,255)
//Graph close - TradePrice
//Graph c1
//Graph MyADR
//Graph MyRange
it uses the DAILY TF to get the daily range.