Hi all:
I am a client of IG, recently I wrote my own strategy and backtest, then put on-line
but today it shows sth. odd…
For forex CAD/JPY today (20/FEB) it shouldn’t have any trade at 01:00 bar by backtest,
but in real auto-trading it sells 1 contract @86.128, and finally get stoploss
does any one know why? Is that an bug?
I attach code here, DSTU_RSI is my own indicator:
// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
// Conditions to enter short positions
indicator1, ignored = CALL "DSTU_RSI"(close)
indicator2 = Stochastic[14,3](close)
indicator3 = Average[3](indicator2)
c1 = (indicator1 < 0)
c4 = (indicator2>70)
IF c1 and c4 THEN
SellP=Low-3*pipsize
else
SellP=2*close
ENDIF
IF close>SellP then
SELLSHORT 1 CONTRACT AT SellP stop
endif
c2 = (indicator2 >= indicator3)
c3 = (indicator2 < 70)
c6 = abs(close-TRADEPRICE(1))>=10*pipsize
IF c2 AND c3 AND c6 THEN
EXITSHORT AT MARKET
ENDIF
// Stops and targets
SET STOP pLOSS 30
EricParticipant
Master
have you checked the spread at the time of the order?
when using stop to open position its the bid and ask that do the job