First of all, I wan't to apologise, if I duplicated any previous subject, but I did not find topics about my problem on that forum.
I wonder why variables TP & SL doesn't work as external ones whereas declaring them without "external" makes everything work correctly. When TP and SL are external variables, during backtesting only first position is opened correctly, but latter ones are being rejected (in journal appear OrderSendError's 130). I know, that this lapse should be associated with too low values of SL or TP, but in my program this error comes out regardless of greatness of above mentioned gauges (even with tp=15 pp). Could you please provide me with any information about presumptive reason of that inconvenient phenomenon? Thank you in advance.
- Are you modifying them? Say in init for 4/5 digit brokers? externals, common(globally declared), and static's are not reloaded on a deinit/init cycle.
- Print out the values before use so you find out why.
- There are no mind readers here. show your code.
extern int SL=10; // SL <= was 10 : SL =OrderStopLoss(); // <= is now 1.2345 which may be less than StopLevel TP =OrderTakeProfit(); // Ticket=OrderSend(Symb,OP_BUY,Lts,Ask,2,Ask-SL*Point,Ask+TP*Point); // ticket=OrderSend(Symbol(),OP_BUY,1,Ask,3,Ask-25*Point,Ask+25*Point,"My order #2",16384,0,Green);
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
First of all, I wan't to apologise, if I duplicated any previous subject, but I did not find topics about my problem on that forum.
I wonder why variables TP & SL doesn't work as external ones whereas declaring them without "external" makes everything work correctly. When TP and SL are external variables, during backtesting only first position is opened correctly, but latter ones are being rejected (in journal appear OrderSendError's 130). I know, that this lapse should be associated with too low values of SL or TP, but in my program this error comes out regardless of greatness of above mentioned gauges (even with tp=15 pp). Could you please provide me with any information about presumptive reason of that inconvenient phenomenon? Thank you in advance.