Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.
From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.
Exclusive Forum
The Exclusive Forum is the only paid section. Once you subscribe, you will get free access to real cutting-edge Trading Systems (automated and not), Indicators, Signals, Articles, etc., that will help and guide you, in ways that you could only imagine, with your Forex trading.
Elite Section
Get access to private discussions, specialized support, indicators and trading systems reported every week.
Advanced Elite Section
For professional traders, trading system developers and any other member who may need to use and/or convert, the most cutting-edge exclusive indicators and trading systems for MT4 and MT5.
In my EA I have a BuyCondition and Sell Condition and a close order for inversed signals. To prevent opening and closing trades inside the same bar I have the following code:
if(OneEntryPerBar==true)
{
if(CheckEntryTime==iTime(NULL,PERIOD_H1,0)) return(0); else CheckEntryTime = iTime(NULL,PERIOD_H1,0);
}
All fine. But now if he finds a sell condition during an open buy trade, he closes the buy, which is OK. But he doesn't open the sell as the above code is preventing this.
Any idea on how to make him close and open inside 1 bar... but only once per bar?
I hope I make myself understood.
Thanks
__________________
Happy Trading...
"Failure is only a temporary change in direction to set you straight for your next success."
"Winning is a habit. Unfortunately, so is losing."
"It’s so simple to be wise. Just think of something stupid to say and then don’t say it."
Can anyone help me with setting up EA that closes all open orders and cancels all pending order at a certain time, i.e., 5:15 a.m. UTC+1 ?
Is it also possible to specify not only the time but the date?
In my EA I have a BuyCondition and Sell Condition and a close order for inversed signals. To prevent opening and closing trades inside the same bar I have the following code:
if(OneEntryPerBar==true)
{
if(CheckEntryTime==iTime(NULL,PERIOD_H1,0)) return(0); else CheckEntryTime = iTime(NULL,PERIOD_H1,0);
}
All fine. But now if he finds a sell condition during an open buy trade, he closes the buy, which is OK. But he doesn't open the sell as the above code is preventing this.
Any idea on how to make him close and open inside 1 bar... but only once per bar?
I hope I make myself understood.
Thanks
it won't open cause of the code you use above.. until the next hour..
you can try this..
Quote:
if (OrderOpenTime() >= iTime(NULL, PERIOD_H1, 0)) order++;
if (order < 1)
{
order conditions
}
hope that helps.. not an expert.. but this code won't stop from doing it more than once..
I Don't Speak English,I want to add Maxtrade And Risk Do you help me
Thankyou
Hi,
You have other issues with this EA. You are stating that you would like to make a buy or sell when VAR1, VAR2 or VAR3 has reached or exceeded certain values.
You must first define what is VAR1, 2 and 3? Some indicator with specific settings?
Does anyone know how to code once the open order hit profit target, the rest of the pending orders will be deleted? It is different from oco. I have checked the elite section, but nothing there.
I do not understand the difference of two programs, but would teach it?
int limit = Bars-IndicatorCounted();
int i ;
for( i=limit-1; i>=0; i--)
int counted_bars=IndicatorCounted();
//---- check for possible errors
if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
if(counted_bars>0) counted_bars--;
I do not understand the difference of two programs, but would teach it?
int limit = Bars-IndicatorCounted();
int i ;
for( i=limit-1; i>=0; i--)
int counted_bars=IndicatorCounted();
//---- check for possible errors
if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
for(i = 0; i <= limit; i++)
The most important difference is the direction of the "for" loop:
The first one scan the bars following the natural time, ie from the oldest to the newest bar.
The second one scan the bars in the opposite direction: it can work if the calcul of a bar doesn't involve the result of the previous bar;
In general it's better to use the same direction as the time: it always works and there are no possibilties of mistaken.