I have created a signal that signals a buy when price retraces to mid, (with some other criteria). But, whenever I backtest the signal, it always gives me only one buy, even though it signals many times on the chart. If I backtest and allow multiple positions at the same time, why would it not keep buying at every signal?
Thanks.
Here is the code:
BEGIN Investor/RT TRADING SIGNAL DEFINITION for BULLISH_MID_RETRACE_DAILY
COMMENT=NONE
SOURCE=
PLATFORM=Windows 10 (6.2, Build 9200)
DATE=2019-10-10 11:46
VERSION=13.6.3 (Build #33358 Sep 23 2019 14:59:26)
DATAFEED=IQFEED
NAME=BULLISH_MID_RETRACE_DAILY
BARCOUNT=AUTOMATIC
ELEM=SESST:Session Statistics Indicator:SESST[ ] MidpointRange PREFS: 0,128,255,2,2,0,0,128,0,1,0,0,9,3,30,1,12701270,2,0,0,5,F,F,1020,11,61.8,F,F,3539980800,3540326400,2,0,60,F,3,F,F,F,1020,405,F,
ELEM=CLOSE:Close
ELEM=PROF:Profile:PROF[ ,1d] PREFS: 128,128,128,1,2,0,0.25,0,200,204,0,0,2,2,0,204,0,0,2,2,0,0,149,0,2,2,0,0,149,0,2,2,0,70,7,14011401,F,T,F,F,4,T,T,F,F,1,2,F,F,3540368487,3540368487,8,3,0,0,F,F,60,F,F,F,F,10,0,0,255,2,2,0,0,2,1,0,1,T,F,0,255,0,2,2,0,255,0,0,2,469791792,0,F,F,0,128,255,3,2,0,9,0,F,T,255,16777215,0,0,F,F,50331903,2,0,9934592,65,50331903,5000,0,0,0,0,3,2,0,0,1,0,1,F,F,F,F,0,0,255,2,2,0,90,T,F,2050.5,2070.5,F,F,BEP34HL,0,4,
ELEM=POS:Position Indicator:POS[ ] Result 5 PREFS: 0,101,202,1,2,0,168,0,0,1,0,0,5,10,744744,10,
ELEM=MA:Moving Average:MA[ ] SC13 Shift Rght 5 PREFS: 0,2,0,128,255,2,2,0,13,0,0,F,F,T,5,T,1,255,0,0,2,0,0,11011101,0,0,255,1,2,0,33488896,33619712,21672,4.000000,8.000000,12.000000,F,F,
ELEM=MA#2:Moving Average:MA[ ] EC3 Shift Left 2 PREFS: 2,2,0,128,255,2,2,0,3,0,0,F,F,T,2,F,1,255,0,0,2,0,0,11011101,0,0,255,1,2,0,33488896,33619712,21672,4.000000,8.000000,12.000000,F,F,
ELEM=LOW:Low
SIGNAL=SESST=CLOSE AND MA#2>=CLOSE AND POS>=30 AND CLOSE>=(SESST-1) \AND PROF>=(SESST+2) AND LOW.1<=SESST
END Investor/RT TRADING SIGNAL DEFINITION for BULLISH_MID_RETRACE_DAILY
BEGIN Investor/RT TRADING SIGNAL DEFINITION for 3_PT_STOP
COMMENT=NONE
SOURCE=
PLATFORM=Windows 10 (6.2, Build 9200)
DATE=2019-10-10 11:46
VERSION=13.6.3 (Build #33358 Sep 23 2019 14:59:26)
DATAFEED=IQFEED
NAME=3_PT_STOP
BARCOUNT=AUTOMATIC
ELEM=TR_FILL:Trade Fill Price
ELEM=LO:Low
ELEM=V#1:Untitled
SIGNAL=LO<=(TR_FILL-3) AND SET(V#1, TR_FILL-3)
END Investor/RT TRADING SIGNAL DEFINITION for 3_PT_STOP
BEGIN Investor/RT TRADING SYSTEM DEFINITION for LONG_MID_RETRACE
SOURCE=
PLATFORM=Windows 10 (6.2, Build 9200)
DATE=2019-10-10
VERSION=13.6.3
DATAFEED=IQFEED
NAME=LONG_MID_RETRACE
PERIODICITY= 1 Minute
SYSTEM=LONG_MID_RETRACE,.Futures,@ES#,52,31,1597895,10,10,0,0,3653552678,3102595738,3102595738,100,3,\0,\0,1,0,0,0,0,5,0,\0,0,18,\0,0,0,0,
RULE 1: Action: BUY, Signal: BULLISH_MID_RETRACE_DAILY,1,0,1,33,1,16,34816,0,134,0,0,0,0,0,0,3,1,0,
RULE 2: Action: SELL, Signal: 3_PT_STOP,5,0,1,33,1,16,34816,0,134,0,0,0,0,0,0,3,1,0,
END Investor/RT TRADING SYSTEM DEFINITION for LONG_MID_RETRACE
TR_FILL is only valid for live trading and represents the fill price of entry when a trade is active (in a position). The token is not valid in backtesting and you must switch to the ENTRY token for backtesting. Replace TR_FILL with ENTRY and the backtest should work properly.