Forex
Google

Go Back   Forex Trading > Downloads > Expert Advisors - Metatrader 4
Forex Forum Register FAQ Members List Calendar Search Today's Posts Mark Forums Read


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

Reply
 
LinkBack Thread Tools Display Modes
  #51 (permalink)  
Old 05-01-2008, 10:49 PM
inzider's Avatar
inzider inzider is offline
Senior Member
 
Join Date: Mar 2008
Location: GMT-5
Posts: 208
inzider is on a distinguished road
Really appreciated!

Quote:
Originally Posted by Yannis View Post
The Sleep() function won't do the trick cause it will suspend everything for the number of milliseconds you will use.
What you need to do is to keep the time of the order's closure (if you want this 'hibernation' to start after the order is closed) or the current time at the moment you want in a variable, add that time + (minutes of delay x 60) to a second variable and then check if current time is greater than 1st variable and less than 2nd variable then only run your SL/TP functions only and skip new orders entry code.
I think i didn't confuse you more :-)
I will be off in a while but i can send you a code snippet tomorrow if you haven't found your way with that. Just tell me how you define the time at which you want this feature to come in play (order closure or any other moment) and how long would you want to skip new orders and simply babysit eventual current orders.

Yannis
Thx Yannis for that quick answer!
Yeah its clear.

What i want exacly is the EA to wait at least next bar to close position by the rules and as i said still apply MM -Babysit could be an exellent option. But if the EA could wait just until nextbar before closing by the rules, that would be perfect. Not an exact time, just wait for nextbar.

That way i would avoid the EA to close position on the same bar at Stoch dips and also would be able to apply a eachtickmode instead of a ElapsedTime order managment that cause innacurate entry.

You think we could do something like that? Like if lastradebar = current bar... no trade... i'm so newb.

Your help is very welcome!
__________________
Common Sens Indicators Active!

Last edited by inzider : 05-02-2008 at 01:00 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #52 (permalink)  
Old 05-02-2008, 01:43 AM
FerruFx FerruFx is offline
Senior Member
 
Join Date: Feb 2007
Posts: 597
FerruFx is on a distinguished road
Quote:
Originally Posted by inzider View Post
What i want exacly is the EA to wait at least next bar
Here's what you need:

if(timeprev!=Time[0]) //---- it will execute the following only if a new bar started
{
YOUR CODE HERE;
timeprev = Time[0]; //---- it register here the open time of the current bar
}

Hope that helps,
FerruFx
__________________
THE HEART of FOREX & THE PROBABILITY METER - Trade with 100% confidence and ... Stress Less!!!
Coding services: Experts Advisors, indicators, alerts, etc ... more info by PM
NEW: video presentation of the Probability Meter ... 24hrs action on the website
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #53 (permalink)  
Old 05-02-2008, 04:23 AM
inzider's Avatar
inzider inzider is offline
Senior Member
 
Join Date: Mar 2008
Location: GMT-5
Posts: 208
inzider is on a distinguished road
Quote:
Originally Posted by FerruFx View Post
Here's what you need:

if(timeprev!=Time[0]) //---- it will execute the following only if a new bar started
{
YOUR CODE HERE;
timeprev = Time[0]; //---- it register here the open time of the current bar
}

Hope that helps,
FerruFx

It would look like that???:

Quote:
//------------------- order management1 -------------------//

if(timeprev!=Time[0]) //---- it will execute the following only if a new bar started
{

//---------------- check indicators and look for a CLOSE1 ---//
if (TotalOpenOrders() == OpenOrders)
{
if (OrderType() == OP_BUY) {
if (sMain<sSignal) { CloseAll(); }
}
if (OrderType() == OP_SELL) {
if (sMain>sSignal) { CloseAll(); }
}
} // end of if we have orders

timeprev = Time[0]; //---- it register here the open time of the current bar
}

//Trailing stop
if(UseTrailingStop && TrailingStop > 0) {
if(Bid - OrderOpenPrice() > Point * TrailingStop) {
if(OrderStopLoss() < Bid - Point * TrailingStop) {
OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * TrailingStop, OrderTakeProfit(), 0, MediumSeaGreen);

}
}
}
}
//Close


//---------------- open management ---------------
if (ElapsedTimeCheck(WaitMinutes) == true) {
//---------------- check indicators and look for a ORDER ENTRY1 ---//
if (TotalOpenOrders() < OpenOrders)

{
if ((MACDValue>MACDSignal)&&(sMain>sSignal)&&(di_p>di _m)&&(adx>ADXStrongTrend)&&(ItrendFilter && iTredn2>ItrendLevel && iTredn2>iTredn1) ||!ItrendFilter) // BUY
{
OrderSend(Symbol(),OP_BUY,LotSize(),Ask,Slippage,A sk-SL*Point,Ask+TP*Point,EAComment,MagicNumber,0,Lime );
}
if ((MACDValue<MACDSignal)&&(sMain<sSignal)&&(di_m>di _p)&&(adx>ADXStrongTrend)&&(ItrendFilter && iTredn1>ItrendLevel && iTredn1>iTredn2) ||!ItrendFilter) // SELL
{
OrderSend(Symbol(),OP_SELL,LotSize(),Bid,Slippage, Bid+SL*Point,Ask-TP*Point,EAComment,MagicNumber,0,Red);
}
} // end of if no orders exist
} // end of main loop
--------------------------------

It look to work on compile but i get error now about the:

ElapsedTimeCheck - expression on a global scope not allowed
WaitMinutes - expression on a global scope not allowed
ShowInfo - is not referenced ..... but i got the code at the end:

void ShowInfo()
{
Comment("...::: Inzider EA FULL :::...\n",
"Copyright © 2008 Inzider\n",
"Currency Pair: ", Symbol(),"\n",
"Price: ",NormalizeDouble(Bid,4),"\n",
"Date: ",Month(),"-",Day(),"-",Year()," Server Time: ",Hour(),":",Minute(),":",Seconds(),"\n",
"Minimum Lot Size: ",MarketInfo(Symbol(),MODE_MINLOT));
return(0);
}

So i don't understand why i get these error.
__________________
Common Sens Indicators Active!

Last edited by inzider : 05-02-2008 at 05:35 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #54 (permalink)  
Old 05-02-2008, 06:56 AM
FerruFx FerruFx is offline
Senior Member
 
Join Date: Feb 2007
Posts: 597
FerruFx is on a distinguished road
Quote:
Originally Posted by inzider View Post
ShowInfo - is not referenced ..... but i got the code at the end:

void ShowInfo()
{
Comment("...::: Inzider EA FULL :::...\n",
"Copyright © 2008 Inzider\n",
"Currency Pair: ", Symbol(),"\n",
"Price: ",NormalizeDouble(Bid,4),"\n",
"Date: ",Month(),"-",Day(),"-",Year()," Server Time: ",Hour(),":",Minute(),":",Seconds(),"\n",
"Minimum Lot Size: ",MarketInfo(Symbol(),MODE_MINLOT));
return(0);
}

So i don't understand why i get these error.
You have the "ShowInfo()" yes but if the rest of your code doesn't call it, it will be flag as "not referenced".

You must call it:

int start()
{
if(your condition == true) ShowInfo();
}

FerruFx
__________________
THE HEART of FOREX & THE PROBABILITY METER - Trade with 100% confidence and ... Stress Less!!!
Coding services: Experts Advisors, indicators, alerts, etc ... more info by PM
NEW: video presentation of the Probability Meter ... 24hrs action on the website
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump



All times are GMT. The time now is 09:12 AM.