pdrhParticipant
Average
DEFPARAM FLATAFTER = 160000
// Prevents the system from creating new orders to enter the market or increase position size before the specified time
noEntryBeforeTime = 100200
timeEnterBefore = time >= noEntryBeforeTime
// Prevents the system from placing new orders to enter the market or increase position size after the specified time
noEntryAfterTime = 160000
timeEnterAfter = time < noEntryAfterTime
ONCE Start=100000
If Time =start then
Tradecount=0
Endif
Timeframe (30minutes,updateonclose)
c1= (close[1]-open[1] )
c2=c1<0
Timeframe (default)
c3=SAR[0.02,0.02,0.2]
c4=close>c3 AND close>open
c5=close <supertrend[3,6]
IF c2 AND c4 And c5 AND Tradecount<1 AND timeEnterBefore AND timeEnterAfter THEN
SELLSHORT 3 CONTRACT AT MARKET
Tradecount=Tradecount+1
ENDIF
// Stops and targets
SET STOP pTrailing 16
SET TARGET pPROFIT 3.4
A trade is being triggered when the condition in the 30 minute timeframe is not met and I can’t see why .The default timefame is 20 seconds.
Any help greatly appreciated.
[attachment file=”Sell SAR.itf”]
On Which instrument did you test it?
It works fine for me.
I suggest that you append these lines at the end of your code:
graph c2
graph c1
so that you can monitor their value when the trade enters (actually the candle BEFORE the arrow plotted by ProBackTest).
pdrhParticipant
Average
I am running this on the ASX200 . Doesnt seem to work as well on other indices
pdrhParticipant
Average
[attachment file=”178615″]
The problem is that the 30 minute calculation is being done on 2 bars before the current bar .
The entry on 27th Sept is at 10:49 but the C1 value is the the value for the 9:30 bar on the 30 minute chart.
I need some help to insert a screen print into my reply
Do not insert pics in your posts, only attach them using the appropriate button.
Thsnks 🙂
It’s important, back to your question, that conditions are met on the 30-minute TF when the trade is entered.
There are 90 20-second bars in 30 minutes, so more trades can be opened before the next 30-minute bar opens.
C2 is met for 30 minutes.