I know a code in simpler syntax and I am new to the Forex (about a month)
I am trying to make revisions to an EA and thus going line by line to understand the Forex logic (and syntax) with certain sections... this is a section that I am trying to understand as I want to make sure that the code doesn't open orders on Friday, but if trades are still open going into Friday to allow it to manage them without closing them
Thanks so much for your help!
=========================
Variables:
int OpenOrders=0, cnt=0;
extern bool TradeOnFriday=False;
int OrdersTimeAlive=0; // in seconds
bool ContinueOpening=True;
datetime LastOrderOpenTime=0;
================================
Code Block:
// if dont trade at fridays then we close all
if (!TradeOnFriday && DayOfWeek()==5)
{
PreviousOpenOrders=OpenOrders+1;
ContinueOpening=False;
text = text +"\nClosing all orders and stop trading because TradeOnFriday protection.";
Print("Closing all orders and stop trading because TradeOnFriday protection.");
}
// Orders Time alive protection
if (OrdersTimeAlive>0 && CurTime() - LastOrderOpenTime>OrdersTimeAlive)
{
PreviousOpenOrders=OpenOrders+1;
ContinueOpening=False;
text = text + "\nClosing all orders because OrdersTimeAlive protection.";
Print("Closing all orders because OrdersTimeAlive protection.");
}
======================================
I am trying to make revisions to an EA and thus going line by line to understand the Forex logic (and syntax) with certain sections... this is a section that I am trying to understand as I want to make sure that the code doesn't open orders on Friday, but if trades are still open going into Friday to allow it to manage them without closing them
Thanks so much for your help!
=========================
Variables:
int OpenOrders=0, cnt=0;
extern bool TradeOnFriday=False;
int OrdersTimeAlive=0; // in seconds
bool ContinueOpening=True;
datetime LastOrderOpenTime=0;
================================
Code Block:
// if dont trade at fridays then we close all
if (!TradeOnFriday && DayOfWeek()==5)
{
PreviousOpenOrders=OpenOrders+1;
ContinueOpening=False;
text = text +"\nClosing all orders and stop trading because TradeOnFriday protection.";
Print("Closing all orders and stop trading because TradeOnFriday protection.");
}
// Orders Time alive protection
if (OrdersTimeAlive>0 && CurTime() - LastOrderOpenTime>OrdersTimeAlive)
{
PreviousOpenOrders=OpenOrders+1;
ContinueOpening=False;
text = text + "\nClosing all orders because OrdersTimeAlive protection.";
Print("Closing all orders because OrdersTimeAlive protection.");
}
======================================