Can not get SL and TP to set at desired points
if(orderType%2==ORDER_TYPE_BUY) { price = Ask; tp = ATR*4; sl = Bid-ATR*2; if(price>(entryPrice-stopsLevel)) { entryPrice = price; orderType = ORDER_TYPE_BUY; } tpBuy = NormalizeDouble(entryPrice+tp,Digits()); slBuy = NormalizeDouble(entryPrice-sl,Digits()); }
I don't understand with this calculation. According to your code your slBuy would be Ask-Bid-ATR*2. If you want your SL to be ATR*2 difference using sl is already right you don't need to use ask price again.
And for your TP, BUY at the ASK and SELL at the BID (including SL and TP) you need to use Bid+ATR*4 instead of ATR*4.
hopefully it will help
I don't understand with this calculation. According to your code your slBuy would be Ask-Bid-ATR*2. If you want your SL to be ATR*2 difference using sl is already right you don't need to use ask price again.
And for your TP, BUY at the ASK and SELL at the BID (including SL and TP) you need to use Bid+ATR*4 instead of ATR*4.
hopefully it will help
I am working on building an EA to look for the candle to Close either above or below the BB, and ride it up or down. The additional parameters include:
I have been able to get it to find the trade setups, and enter both Buy and Sell. But I can not get the TP and SL to be set to the points I am wanting. I am using the ATR with a multiplier to set the SL based on the previous LowestLow within a range, and TP based on the risk reward ratio compared to the SL. I can not figure out how to get the R/R ratio input. And my current SL is getting put to a ridiculously far point, and do not know why. Any input to help with this would be greatly appreciated. Feel free to test it and manipulate it.