One Trade Help needed

 

Hi, Can anyone let me know the code to make  only one trade a day. If it has opened a trade then irrespective whether it wins or loses that trade it must not open another trade. Many thanks

How to code?...please help...

 

Dieesels, please search the forum.

This is probably THE most popular question.

It gets asked at least once per week.


CB

 

I found EA, but that is not what I want. You can specify maximum number of trade in manual keying?

 
Dieesels:

I found EA, but that is not what I want. You can specify maximum number of trade in manual keying?


Dieesels,


This is something I struggled with for a bit of time-it is actually quite easy:

if(GlobalVariableCheck("audusdStop")==false)

OrderSend(Symbol(),OP_SELLSTOP,lot2,Ask-100*Point,3,Ask-1*Point,Ask-120*Point,NULL,MagicNumber12,0,Green);

GlobalVariableSet("audusdStop",1);//allows only one order to be put on!

Print("4 Hour audusd trading is stopped");


If you simply use a globalvariable, you can check to see if it exists first before trading. Once the trade has been placed(as illustrated above), then set the globalvariable and next time back around, the value will be true, not false hence preventing another go through that piece of code(will not place another order). Now all you have to do is figure out how to remove the globalvariable the next day! ;)


That is actually quite easy. Hope this helps......


Daniel

Reason: