Tobias Johannes Zimmer #: The last posts were about this: A buy position is opened by a buy deal with ask price, but closed by a sell deal with bid price and vis versa.
So you have to calculate tp/sl from bid price for a buy and from ask price for a sell position.
Otherwise it would be inaccurate by the span of the spread which can be quite considerate.
Not related to your question, but I note that you are calling iBands/iEnvelopes in the OnTick() loop. This is not recommended - You should only call them once from OnInit() then reference the handle in OnTick().
Thank you for your time and the responses. Please bear with me as I'm trying to understand how this works.
@ceejay1962 Thanks for the advice, ill take it into consideration. I am going to figure out how that works.
I thought I would just share it with the community as it turns out to be a pretty decent strategy.. according to backtest.. Im still trying to figure out on how to optimise the code so it can Backtest quicker.. im assuming its due to me putting everything on the OnTick function?
Quick update! I finally got it exactly how i wanted! Thank you all for the advice, it really kept me going. The expert is definitely worth checking out. I got some insane back tests 100% history quality.
The last posts were about this: A buy position is opened by a buy deal with ask price, but closed by a sell deal with bid price and vis versa.
Not related to your question, but I note that you are calling iBands/iEnvelopes in the OnTick() loop. This is not recommended - You should only call them once from OnInit() then reference the handle in OnTick().
Thank you for your time and the responses. Please bear with me as I'm trying to understand how this works.
@ceejay1962 Thanks for the advice, ill take it into consideration. I am going to figure out how that works.
@Tobias Johannes Zimmer Thank you for clearing that out for me.
I managed to get it somewhat working how I'd like it to :)
I thought I would just share it with the community as it turns out to be a pretty decent strategy.. according to backtest.. Im still trying to figure out on how to optimise the code so it can Backtest quicker.. im assuming its due to me putting everything on the OnTick function?