Inserted Code
double EntryBuy = HighestPriceOfRange+(PipBox*Point); double EntrySell = LowestPriceOfRange-(PipBox*Point); double RangeSpan = HighestPriceOfRange-LowestPriceOfRange; double Additive = RangeSpan*0.5; double TakeProfit1 = (RangeSpan*0.2*Point); double TakeProfit2 = (RangeSpan*0.5*Point); double TakeProfit3 = RangeSpan; double StopLossBuy = LowestPriceOfRange+Additive; double StopLossSell = HighestPriceOfRange-Additive;
Having some trouble with this code. I am trying to get it to set my TP at 20%, 50%, and 100% of the recorded range size, in pips, plus a pipbox. The pipbox variable is the size of the envelope I set for above and below the range. Invariably, I need it to be part of the TakeProfit variables, but whenever I try to incorporate it, MT4 does a poltergeist on me and throws up 120mb log files filled with "error 130", or when it does work after fiddling, my TP is something absurd like 10.xxxx on GBP/USD. Why does it seem so hard to figure out something so simple?
The rest of the code functions as planned, it's only the take profit variables that are screwing up on me. Also, even though the StopLossBuy and StopLossSell variables print the same price, the code goes nuts if you don't separate them out like that.
Never underestimate the powers of the Force.