Passing on tick variable into OnChartEvent....??????
double TP_buy, SL_buy, TP_sell, SL_sell;
double TP_sell = Bid-TakeProfit; You are redefining TP_sell and the other variables on entrance of OnTick, so that when OnTick exits its value is lost. Just don't do that - you already have it defined in the global scope, that's ok, keep it there.
I'm a newbie to programming, so please forgive this as probably a very stupid question....
I'm trying to pass a variable ("SL_sell" - see below) into an OnChartEvent - so that when a Sell Button is pressed, the Stop Loss is defined by the ATR value (which is being constantly updated in OnTick)...
but have no idea how to make this work... I'm not even sure if I'm asking the right question!
Any help much appreciated.