Is it possible ?
Regards
Regards
MT4 main window doesn't show, but terminal.exe is still running 1 reply
MQL4 Language Most Recent Version is it updated beyond the tutorial on the mql4 websi 6 replies
MetaLang.exe virus on MetaTrader... 2 replies
#import "shell32.dll" int ShellExecuteA(int hWnd, int lpVerb, string lpFile, int lpParameters, string lpDirectory, int nCmdShow); #import
Dislikedneed coding help for 2 things:
1.
the event -- price crosses trigger from below / above :
double myTrigger;
if (Ask crosses myTrigger from below)
{
SendOrder(Symbol(), OP_BUY...);
}
if (Bid crosses myTrigger from above)
{
SendOrder(Symbol(), OP_SELL...);
}
I suppose I will need to access value of previous tick for that:
if (previous_tick < myTrigger && current_tick > my Trigger) {SendOrder(...);}
BUT I couldn't find any way to do that in the documentation and forums. Perhaps, there's another way too...
Kindly guide.
2.
I have...Ignored
WRCurrent = iWPR(Symbol(), 0, Williams, 1); WRLast = iWPR(Symbol(), 0, Williams, 2); mafast = iMA(Symbol(), 0,MAFast,0,MODE_EMA,PRICE_CLOSE,1); maslow = iMA(Symbol(), 0,MASlow,0,MODE_EMA,PRICE_CLOSE,1); if (UseMAFilter) { if(mafast>maslow) {up = true;down = false;} if(mafast<maslow) {up = false;down = true;} } if ( up && WRCurrent > -80 && WRLast < -80 && NoOpenOrders() == false && sellsareopen ) { CloseTrades(OP_SELL,OP_SELLLIMIT,OP_SELLSTOP); sellsareopen = false; } if ( up && WRCurrent > -80 && WRLast < -80 && NoOpenOrders() && Hour() >= StartTrading && Hour() < StopTrading && timenow != Time[0] ) { price = High[1]+(Ask-Bid)+(OffsetPips*Point); Buy(price); buysareopen = true; timenow = Time[0]; } if ( down && WRCurrent < -20 && WRLast > -20 && NoOpenOrders() == false && buysareopen ) { CloseTrades(OP_BUY,OP_BUYLIMIT,OP_BUYSTOP); buysareopen = false; } if ( down && WRCurrent < -20 && WRLast > -20 && NoOpenOrders() && Hour() >= StartTrading && Hour() < StopTrading && timenow != Time[0] ) { price = Low[1]-(OffsetPips*Point); Sell(price); sellsareopen = true; timenow = Time[0]; }
Dislikeddouble myTrigger;
double Askcurrent = iClose(NULL,0,0)+(Ask-Bid);
double Askprevious = iCloseNULL,0,1)+(Ask-Bid);
double Bidcurrent = iClose(NULL,0,0);
double Bidprevious = iClose(NULL,0,1);
if ( Askcurrent > myTrigger && Askprevious < myTrigger )
{
SendOrder(Symbol(), OP_BUY...);
}
if ( Bidcurrent < myTrigger && Bidprevious > myTrigger )
{
SendOrder(Symbol(), OP_SELL...);
}
or
you can use Close[0] +(Ask-bid);
Close[1]+(Ask-Bid);
if you prefer.Ignored
DislikedS M Jones,
Thanks.
sorry for coming back after a lapse of so many days of your response. I was travelling.
I understand your solution is comparing the close of 2 completed bars. tell me if i am wrong. what I want is this:
e.g.
myBuyTrigger = 1.4650
current price = 1.4657
I DON'T WANT to buy as soon as price drops to 1.4650 bcos that wud be hitting the trigger from above.
I WANT to buy AFTER price drops below 1.4650 and then hits the trigger 1.4560 FROM BELOW.
This is going to happen most likely WITHIN THE SAME BAR. So, Close[0], Close[1]...Ignored
DislikedI think you can start counter for every tick within the same bar. reset when start of new bar.
condition should be:
if(countercurrent>counterprevious && AskPrevious<MyBuyTrigger && AskCurrent>MyBuyTrigger)Ignored
ShellExecuteA(0,"open","notepad.exe",0,0,5); // not working
ShellExecuteA(0,"open","C:\\WINDOWS\\system32\\notepad.exe",0,0,5);
ShellExecuteA(0,"open","notepad.exe",0,"C:\\WINDOWS\\system32\\",5);