if lasttrade==NULL then what?
if lasttrade==NULL then what?
That is not a problem we can replace that with:
bool buycondition=true; //initialization
bool sellcondition=true;
if(buycondition==true) {
//code
sellcondition=false;
buycondition=true;}
and same for sell also.
But my problem is that it is not executing close orders at all. And also misses to open positions!!!!
Please can u suggest some way to overcome this...
Thank you.
Please also tell me how can I open only one order at a time for each currency. i.e even if two currencies are being traded simultaneously, each should have only one trade on for each.(Total trades ON==2)
I checked it with the tester and it opens orders just fine
Sir,
Thank you for checking it.
But it doesn't close orders when required!!!
It also leaves some trades. For a crossover it might not open a trade or may end a trade before any crossover.
Also when i add Period() in comment section of OrderSend(), it doesn't execute any trade. Same for numerical values of stop-loss and take-profit.
Sir,
Thank you for checking it.
But it doesn't close orders when required!!!
i'm not sure but could be if(Volume[0]>1) return; causing not to close (Sometimes there are two tics by bar opening)
i'm not sure but could be if(Volume[0]>1) return; causing not to close (Sometimes there are two tics by bar opening)
well, yes it is. He is supposed to use Time[0] instead.
Good Luck,
SF
well, yes it is. He is supposed to use Time[0] instead.
Good Luck,
SF
Time[0] is not what he meant he wants only the first tick (//---- go trading only for first tiks of new bar)
Thank you for your suggestions. I've used Time[0], but still it doesn't visit the checkforclose()!!!!
It only shuttles in the checkforopen()!!!
You can only see "BUY" and "SELL" comments.... even tough start() has both of them!!!

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I'm writing a code for Moving average crossover. The most basic concept.
FastMA>SlowMA==BUY
SlowMA>FastMA==SELL.
But i'm having trouble in it. It's been few days since i'm having this trouble.
It misses opportunities to buy and sell, even though the loop for that trade is executed.
Please guide me about wht the problem is.
Thanks in advance.
P.S. :: The comments arefor checking whether the loop is visited. Also in strategy tester it doesn't give alerts!!!! :(