return() is not function! It is program statement like if, for, switch, while etc
Insert Print functions to control program flow
Insert Print functions to control program flow
Hi Slawa,
Thank you for the comments. Using the Print function only I found out that the program ran through the return(0) functions/statements. But, I cannot figure out why/how does it do that and don't know how to make it respect the return(0)s.
-chandra
Thank you for the comments. Using the Print function only I found out that the program ran through the return(0) functions/statements. But, I cannot figure out why/how does it do that and don't know how to make it respect the return(0)s.
-chandra
Hi Slawa,
I call this routine only once from the Start routine. But when in the next round of call after opening a position (during next tick), the call will miss it because it is controlled by open position. The code making the call is:
if(nopen==0) Decision();
My Print function I have included in the first post should not come at the first purchase of a position. But always when one position entry is made, second entry is also made and the Print command comes exactly in between. That showed that the execution went right through the return(0) statement. If it bought a position using {openBuy(); return(0); } it is not possible to go beyond. But it goes beyond and executes the other OpenBuy because the if conditions will be true, because the open positions are not included here (even when I included the open position condition before Print command [ if (nOpen > 0) return(0);] still it did not work!!! It keeps opening two positions. I dont create/check log file, but I see the Print text in the Journal section.
Thanks
-chandra
I call this routine only once from the Start routine. But when in the next round of call after opening a position (during next tick), the call will miss it because it is controlled by open position. The code making the call is:
if(nopen==0) Decision();
My Print function I have included in the first post should not come at the first purchase of a position. But always when one position entry is made, second entry is also made and the Print command comes exactly in between. That showed that the execution went right through the return(0) statement. If it bought a position using {openBuy(); return(0); } it is not possible to go beyond. But it goes beyond and executes the other OpenBuy because the if conditions will be true, because the open positions are not included here (even when I included the open position condition before Print command [ if (nOpen > 0) return(0);] still it did not work!!! It keeps opening two positions. I dont create/check log file, but I see the Print text in the Journal section.
Thanks
-chandra
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 have the above code. The return(0) functions seem to be not working. After opening one trade, instead of returning, it goes ahead to next lines and opens another trade (the second set of openings are only if first attempt failed, but it always opens two at once). I tried separating them to another routine and it still did not solve the problem (though it opened the second trades after one minute, which I have to analyze separately). I cannot think of anything wrong here. So, any suggestions will be greatly appreciated.
-chandra