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.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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.