Hi, I have an intraday strategy that is active after the close of the regular session (after 18.00 exchange time) to 6.00. Since I want it to take only one trade per day I used the function entriestoday(date[0]) < 1. The issue is that if the strategy takes a trade between 18.00 and midnight and then closes it either if stop loss or target is hit, the function entriestoday(date[0]) does not stop the strategy from taking another trade after midnight if the entry criteria is met. Is there a way to get around it? Maybe a different function that refers to the entire regular session from open to close?
Thank you.
Can you help answer these questions from other members on futures io?
The easiest way to do this would be to initialize an int i before any of your other strategy logic.
eg.
int i;
Next at the time that you want to begin trading, set i=0
eg.
if(ToTime(Time[0]) == 180000) i=0;
In the conditional if statement that would trigger your entry order, include
&& i < 1 and in the line after your entry order placement line, write i++;
eg.
if(CrossAbove(EMA(20),EMA(50),1) && i<1)
{
EnterLong();
i++;
}
Note: I don’t use EasyLanguage so this is based on NT8 C#. But the underlying logic principles still apply. Essentially, you need to avoid using the predefined function that will reset entries at midnight and manually increment an entry order count and reset it to zero when you want the next trading session to start.
The following user says Thank You to Rovo27 for this post: