Hi Admin/CP
Is there a function I can call to open the trade window?
I know I can use the OrderSend fn to open a new trade.
Let me explain 1st what I've done.
I have that Advanced Currency Meter and a Daily FX indi's open.
Both only print objects on the chart, so I get the object values etc etc.
As you can see in the code below, if certain conditions are met, the EA will pop up a OK/Cancel MessageBox.
If I decide to take the trade and press OK, (int of 1) it must open the trade window (And then also go to sleep for a while), or else it must sleep for x amount of time.
(I will still see how else I can keep the EA quiet, because it will obviously keep on popping up the MessageBox while the 2 green arrows are on the chart, and that can sometimes last quite some time, so I thought Sleep is the best option.)
string c02 = ObjectGetString(0,"label-02",OBJPROP_TEXT);//GBPUSD
string a02 = ObjectGetString(0,"act-02",OBJPROP_TEXT);
string tp02 = ObjectGetString(0,"ttp-02",OBJPROP_TEXT);
string GBPUSD = ObjectGetString(0,"currency41",OBJPROP_TEXT);
double cl02 = iClose(c02,0,0);
double diff = (cl02-StrToDouble(tp02));
if ((c02=="GBPUSD")&& (a02 == "Buy") && (GBPUSD==buy) && (cl02<tp02))
{ int mb = MessageBox("Buy Signal "+c02+
"\n TP"+tp02,"Trade Alert"
,0x00000001) ;
if (mb == 1)
{ Sleep (SleepTime);}
// Here I need to place an order, or cancel the MB
if (mb==2)
{ Sleep (30000);}
}
This is just part of the EA.
I will try to fully automate this, but the OrderSelect fn etc are still getting me down, as these Indi's only need to be on one chart, (They are quite resource hungry) thus the reason I also get the symbol from the EA, so the chart can be on any pair, but the EA will only notify the symbol(s) which meet(s) the requirements.
This is why for now I want to manually place the order.
(Yes, I know I can just open the trade window and place the order, but with all the features etc available in MQL4, I thought there might be a way, if I select OK, it will open a place order feature or something)
Thanks for the help again.
Linkback: https://www.forex.zone/mt4-mt5-eas/7/function-to-open-mt4-trade-window/376/