| New signals service! | |
|
|||||||
| Register in Forex TSD! | |
|
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time). Click here to register and get more information |
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Quote:
PHP Code:
|
|
|||
|
MQL4 LEARNING: i dont no why my ea error.
Hello can someone help me plz?
i m newbie in metaquoates language. i start learning by edit the simple ea first. refer to my stoch ea, there are some error.. why my ea not take trade when the stoch line cross for that area ( mark by text'?')?? not all but some look ok( mark by text 'ok'). sorry for my english. very thankfull for any help. PHP Code:
Last edited by rayz; 02-11-2008 at 04:57 AM. |
|
|||
|
Timelimit on orders
Hello,
I am in the process of programming an EA and trying to place a time limit on orders. For example, if a trade is opened on the first of the month I would like to force it to close if the parameters on my EA are not reached by the fifth day or so. I have tried to search the forum, but with so many results with the terms "time limit" I have failed to find an answer. Thanks for your help! |
|
|||
|
Quote:
Hope this helps
__________________
Need a professional MQL4 programmer? PM me Last edited by Devil2000; 02-14-2008 at 04:42 PM. Reason: grammar |
|
|||
|
higher/lower price for a symbol between 2 specific times
Quote:
All the best, Hiachiever void CreateTradeSession(string RecName, datetime dt, string tb, string te, color RecColor) { datetime Time1, Time2; double Price1, Price2; int b1, b2; Time1=StrToTime(TimeToStr(dt, TIME_DATE)+" "+tb); Time2=StrToTime(TimeToStr(dt, TIME_DATE)+" "+te); if (CurTime()>= Time1) //Preview 1 hour before { if(ObjectFind(RecName) != 0) { ObjectCreate(RecName, OBJ_RECTANGLE, 0, 0,0, 0,0); ObjectSet(RecName, OBJPROP_STYLE, STYLE_SOLID); ObjectSet(RecName, OBJPROP_COLOR, RecColor); ObjectSet(RecName, OBJPROP_BACK, True); } b1=iBarShift(NULL, 0, Time1); if (Time2>CurTime()) Time2 = CurTime(); b2=iBarShift(NULL, 0, Time2); Price1=High[Highest(NULL, 0, MODE_HIGH, b1-b2, b2)]; Price2=Low [Lowest (NULL, 0, MODE_LOW , b1-b2, b2)]; ObjectSet(RecName, OBJPROP_TIME1 , Time1); ObjectSet(RecName, OBJPROP_PRICE1, Price1); ObjectSet(RecName, OBJPROP_TIME2 , Time2); ObjectSet(RecName, OBJPROP_PRICE2, Price2); } } |
|
|||
|
I didn't found a posted thread that explain about this.
I want to limit my open to 1 open/day only. Here is the code if(CheckJustClosedOrder()==1) {return(0);} and the function is Code:
int CheckJustClosedOrder()
{
int cnt;
datetime orderclosetime, rightnow;
int TheHistoryTotal=OrdersHistoryTotal();
int flag=0;
for(cnt=0;cnt<TheHistoryTotal;cnt++)
{
if(OrderSelect(cnt,SELECT_BY_POS,MODE_HISTORY)==true)
{
if ( (OrderSymbol()==Symbol()) && (OrderMagicNumber()==MagicNumber) && (OrderComment()==GetCommentForOrder()) )
{
orderclosetime=OrderCloseTime();
rightnow=CurTime();
if(rightnow-orderclosetime<36000)
{ // At least 10jam away!
flag=1; // Throw a flag tanda tidak boleh open
break;
}
}
}
}
return(flag);
}
Last edited by pipsmaster; 02-26-2008 at 05:23 AM. |
|
|||
|
Few of my EAs working with OrdersHistoryTotal() and it's doing well on backtest. Your problem maybe on OrderComment() function. You can use it as identifier only when it's an active order. For closed order, MT4 modify it a little bit, adding [tp] if it was closed by takeprofit or [sl] if it was closed by stoploss.
__________________
Need a professional MQL4 programmer? PM me |