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.
Need coding to close out positions created by EA on Friday just before close of week!
1) Can anyone help to provide the ea coding to close out all positions just before the market closes on Friday.
2) Also, coding needed to put each ea to sleep at the same time on Friday PM (So it does not open up any new positions) until Sunday PM when it will allow the ea to trade again.
Hi, I was hoping someone could help me and explain a couple of errors I received while testing an EA I am writing.
I ran the EA through the night to see if it was working properly and when I woke there were a couple of errors that I can't find an explanation for.
subtracting the counted_bars from the total count of the bars on chart.
Thanks.
Take a look to the mql4 help file:
Quote:
int IndicatorCounted( )
The function returns the amount of bars not changed after the indicator had been launched last. The most calculated bars do not need any recalculation. In most cases, same count of index values do not need for recalculation. The function is used to optimize calculating.
Note: The latest bar is not considered to be calculated and, in the most cases, it is necessary to recalculate only this bar. However, there occur some boundary cases where custom indicator is called from the expert at the first tick of the new bar. It is possible that the last tick of the previous bar had not been processed (because the last-but-one tick was being processed when this last tick came), the custom indicator was not called and it was not calculated because of this. To avoid indicator calculation errors in such situations, the IndicatorCounted() function returns the count of bars minus one.
I think it is the number of the bars which was not changed after the last indicator's call.
For example we had 300 bars. Then EA may call indicator for the signal or to open the order. For example: H1 timeframe. So we still have 300 unchanged bars. Because 301th bar is open bar and this bar will not be counted.
Because many indicators and EAs are calculated using i bars so using this function we may be sure that this i number of bars was unchanged and indicator will not re-paint and everything will be on close bar.
It is example in help file:
Code:
int start()
{
int limit;
int counted_bars=IndicatorCounted();
//----
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
//----
for(int i=0; i<limit; i++)
{
//----
ExtBlueBuffer[i]=iMA(NULL,0,JawsPeriod,0,MODE_SMMA,PRICE_MEDIAN,i);
ExtRedBuffer[i]=iMA(NULL,0,TeethPeriod,0,MODE_SMMA,PRICE_MEDIAN,i);
ExtLimeBuffer[i]=iMA(NULL,0,LipsPeriod,0,MODE_SMMA,PRICE_MEDIAN,i);
}
//----
return(0);
}
But, sorry, I am not a coder so may be wrong.
Last edited by newdigital; 07-22-2007 at 03:42 PM.