Well,
thing is that in Pi backtest Buy and trade signals are generated only at the closing price of the signal candle.
This generated quite a wrong trades.
Is it possible to generate Buy signals at Open, Hi, Low or any thing in between like crossover point?
yeah you can give condition based on OHL also , try replacing High or Low in the place of Close in your script.
@AlgoGeek
Thanks for your reply.
The problem I am facing is that the BUY or SELL prices of the trades generated are always at the CLOSE of the candle.
Like if I want to code scalping strategy - Buy at the previous candle High breakout and Sell at the candle end.
OR Sell at the previous candle Low breakout and Buy at candle end
@AlgoGeek
So I coded following script
BUY: LAST > REF (HIGH,1) = TRUE
Exit LONG : CLOSE
SELL: LAST > REF (LOW,1) = TRUE
Exit SHORT: CLOSE
I ran this script in Pi
The Back test Chart
Now the problems in the Backtest.
- Even though I put in 60 days for backtest, the trades are only shown of last ~40 days only.
- Consider a trade at 09/25/2017 2:00:00 PM
LONG at 9865 and EXIT LONG also at 9865
Same thing in all the trades.
9/25/2017 12:15:59 PM,LONG,9894.3000
9/25/2017 12:15:59 PM,SHORT,9894.3000
9/25/2017 12:15:59 PM,EXIT SHORT,9894.3000
9/25/2017 12:59:59 PM,SHORT,9876.8500
9/25/2017 1:15:00 PM,EXIT SHORT,9876.8500
9/25/2017 1:45:59 PM,SHORT,9851.0500
9/25/2017 2:00:00 PM,LONG,9865.0000
9/25/2017 2:00:00 PM,EXIT LONG,9865.0000
9/25/2017 2:15:00 PM,SHORT,9872.5000
9/25/2017 2:15:00 PM,LONG,9872.5000
9/25/2017 2:15:00 PM,EXIT LONG,9872.5000
9/25/2017 2:30:59 PM,SHORT,9879.9000
9/25/2017 2:30:59 PM,LONG,9879.9000
9/25/2017 2:30:59 PM,EXIT LONG,9879.9000
9/25/2017 2:45:00 PM,SHORT,9874.9500
9/25/2017 2:45:00 PM,EXIT SHORT,9874.9500
9/25/2017 3:00:00 PM,SHORT,9882.0000
9/25/2017 3:00:00 PM,EXIT SHORT,9882.0000
9/25/2017 3:15:59 PM,SHORT,9880.0000
9/25/2017 3:15:59 PM,EXIT SHORT,9880.0000
9/26/2017 9:30:00 AM,SHORT,9871.0000
9/26/2017 9:30:00 AM,EXIT SHORT,9871.0000
9/26/2017 9:45:00 AM,SHORT,9877.4500
9/26/2017 9:45:00 AM,EXIT SHORT,9877.4500
9/26/2017 9:45:00 AM,LONG,9877.4500
9/26/2017 9:45:00 AM,EXIT LONG,9877.4500
9/26/2017 10:15:00 AM,SHORT,9856.3500
9/26/2017 10:15:00 AM,EXIT SHORT,9856.3500
9/26/2017 10:30:00 AM,SHORT,9845.8000
9/26/2017 10:30:00 AM,EXIT SHORT,9845.8000
9/26/2017 11:00:00 AM,SHORT,9836.8000
9/26/2017 11:00:00 AM,EXIT SHORT,9836.8000
9/26/2017 11:15:00 AM,SHORT,9838.6500
9/26/2017 11:15:00 AM,EXIT SHORT,9838.6500
9/26/2017 11:45:00 AM,SHORT,9842.8500
9/26/2017 11:45:00 AM,LONG,9842.8500
9/26/2017 12:00:00 PM,SHORT,9861.3000
9/26/2017 12:00:00 PM,EXIT SHORT,9861.3000
9/26/2017 12:15:59 PM,SHORT,9855.5500
9/26/2017 12:15:59 PM,EXIT SHORT,9855.5500
@AlgoGeek
Same Old Question
I have backtested almost all EAs and codes available. My observations -
Same strategy/EA gives 30-40% profit when backtested on one timeframe and gives -30% on other timeframe.
ie the results of a EA changes drastically by just replacing 1 min by 15 min.
Also the results vary across scrips.
Can you tell me one strategy which gives reasonably consistent results across all scrips and timeframes.
TIA