Anyone who wanted to see charts without missing bars - here =) - page 9

 
I have figured out the reason why the developers have prohibited EAs from working on offline charts.
I think it has to do with the fact that for offline charts Bid and Ask return 0. That is, for Expert Advisors that want to open on the market it is impossible. But I came up with the following solution for my EA that works only with pending orders: change Bid and Ask for _Bid() and _Ask() using the auto substitution. _MarketInfo() returns the spread for the instrument being traded.

int _MarketInfo(string symb_for_work)
{
   if(symb_for_work=="USDCHFm") return(4);
   if(symb_for_work=="CHFJPYm") return(5);
   if(symb_for_work=="GBPUSDm") return(3);
   if(symb_for_work=="USDCADm") return(5);
   if(symb_for_work=="USDJPYm") return(3);
   if(symb_for_work=="EURGBPm") return(4);
   if(symb_for_work=="AUDUSDm") return(4);
   if(symb_for_work=="EURCHFm") return(4);
   if(symb_for_work=="EURJPYm") return(5);
   if(symb_for_work=="EURUSDm") return(2);
   if(symb_for_work=="NZDUSDm") return(6);
   if(symb_for_work=="AUDJPYm") return(6);   
 
return(0);
}
 
double _Bid()
{
   return(Close[0]);
}
 
double _Ask()
{
   return(Close[0]+_MarketInfo(symbol_for_trade)*Point);
}
I think the idea is clear. Judging by the first results of the revised EA, the orders open normally. Now it is the weekend so I will test it in details when trading starts next week. I think I will be able to fulfil what I initially wanted.
 
IMHO, nonsense ...
If the developers saw that "for offline charts Bid and Ask return 0",
what prevents them from fixing it?
 

Well, offline charts can be updated quite infrequently, for example. And during the refresh interval, for example 1-2 minutes, the real Ask and Bid can go quite far from what is displayed in the offline chart. And RefreshRates() will not help here at all. Well, there must have been some other reasons besides the one already discovered. But only the developers can answer that.

 
solandr:

Well, offline charts can be updated quite infrequently, for example. And during the refresh interval, for example 1-2 minutes, the real Ask and Bid can go quite far from what is displayed in the offline chart. And RefreshRates() will not help here at all. Well, there must have been some other reasons besides the one already discovered. But only the developers can answer that.

Right, if the chart is not updated, the Bid will become obsolete.
But so will Close[0]!

You cannot use knowingly wrong prices in a trading Expert Advisor.
Use MarketInfo( MODE_BID ) and MarketInfo( MODE_ASK ) to get a fresh price )
 

Basically, I am quite satisfied with Close[0] ;o)
I am not in a hurry. I even slow down the Expert Advisor on purpose ;o) according to the following principle:

1. If the current price is at least 50 pips away from the provider, the provider can modify the provider order only if it is necessary to move it by at least 10 pips.
2. If the current price is within the range of 25...50 pips from the "Oder", the Expert Advisor is allowed to modify the "Oder" only if it is necessary to modify the order by 5 pips or more.
3. If the current price is closer than 25 pips to the order, the Expert Advisor will move the pending orders by 2 pips or more.

This scheme allows us to reduce the number of pending order moves at least 5 times, if not more! :o) It turns out to be from 0 (at night) to 20 (during news events) moves per hour, on average, for a total amount of about 60 pending orders (for 12 currencies)! I.e. there are probably not more than 200 moves per day, and not every day. In general, I think that in manual trading people can move orders even more, if they exactly follow one certain strategy and play with the same amount of currency pairs! ;o)

 

komposter, once again a BIG THANK YOU for developing an Expert Advisor that merges Sunday's day candles with Monday's!!!
I have been working with your script for a month now on the real. I start the script to process 19 currency pairs (all available at InterbankFX) for 600 intraday bars each. I set the refresh time of charts to 1 minute. All works smoothly on the CPU VIA C3 800 MHz!

I've noticed one small feature, I assume this is a feature of the terminal, not the Expert Advisor, to which I personally have no complaints! When working in Metaeditor I try to compile any EA that is not even attached to a chart, the terminal generates errors in its logs. At the same time this fact shows up stably both on 800MHz processor, as well as on P4 3GHz and Celeron 2GHz. Build 198. I didn't tried it on 200 as there are some problems with updates on InterbankFX (update request appears but builds are not downloading - but it doesn't matter).
******************************
2006.12.09 03:26:29 WithoutSunday_4: invalid handle -1 in FileFlush
2006.12.09 03:26:29 29 WithoutSunday_4: invalid handle -1 in FileWriteDouble
2006.12.09 03:26:29 29 WithoutSunday_4: invalid handle -1 in FileWriteDouble
2006.12.09 03:26:29 29 WithoutSunday_4: invalid handle -1 in FileWriteDouble
2006.12.09 03:26:29 29 WithoutSunday_4: invalid handle -1 in FileWriteDouble
2006.12.09 03:26:29 29 WithoutSunday_4: invalid handle -1 in FileWriteDouble
2006.12.09 03:26:29 29 WithoutSunday_4: invalid handle -1 in FileWriteInteger
2006.12.09 03:26:29 29 WithoutSunday_4: invalid handle -1 in FileSeek
2006.12.09 03:26:29 29 WithoutSunday_4: invalid handle -1 in FileFlush
2006.12.09 03:26:29 29 WithoutSunday_4: invalid handle -1 in FileWriteDouble
2006.12.09 03:26:29 29 WithoutSunday_4: invalid handle -1 in FileWriteDouble
2006.12.09 03:26:29 29 WithoutSunday_4: invalid handle -1 in FileWriteDouble
2006.12.09 03:26:29 29 WithoutSunday_4: invalid handle -1 in FileWriteDouble
2006.12.09 03:26:29 29 WithoutSunday_4: invalid handle -1 in FileWriteDouble
2006.12.09 03:26:29 29 WithoutSunday_4: invalid handle -1 in FileWriteInteger
2006.12.09 03:26:29 29 WithoutSunday_4: invalid handle -1 in FileSeek
2006.12.09 03:26:29 29 WithoutSunday_4: invalid handle -1 in FileFlush
2006.12.09 03:26:29 29 WithoutSunday_4: invalid handle -1 in FileWriteDouble
2006.12.09 03:26:29 29 WithoutSunday_4: invalid handle -1 in FileWriteDouble
2006.12.09 03:26:29 29 WithoutSunday_4: invalid handle -1 in FileWriteDouble
2006.12.09 03:26:29 29 WithoutSunday_4: invalid handle -1 in FileWriteDouble
2006.12.09 03:26:29 29 WithoutSunday_4: invalid handle -1 in FileWriteDouble
2006.12.09 03:26:29 29 WithoutSunday_4: invalid handle -1 in FileWriteInteger
2006.12.09 03:26:29 29 WithoutSunday_4: invalid handle -1 in FileSeek
2006.12.09 03:26:29 29 WithoutSunday_4: invalid handle -1 in FileFlush
2006.12.09 03:26:29 29 WithoutSunday_4: invalid handle -1 in FileWriteDouble
2006.12.09 03:26:29 29 WithoutSunday_4: invalid handle -1 in FileWriteDouble
2006.12.09 03:26:29 29 WithoutSunday_4: invalid handle -1 in FileWriteDouble
2006.12.09 03:26:29 29 WithoutSunday_4: invalid handle -1 in FileWriteDouble
2006.12.09 03:26:29 29 WithoutSunday_4: invalid handle -1 in FileWriteDouble
2006.12.09 03:26:29 29 WithoutSunday_4: invalid handle -1 in FileWriteInteger
2006.12.09 03:26:29 29 WithoutSunday_4: invalid handle -1 in FileSeek
2006.12.09 03:26:29 29 WithoutSunday_4: invalid handle -1 in FileFlush
2006.12.09 03:26:29 29 WithoutSunday_4: invalid handle -1 in FileWriteDouble
2006.12.09 03:26:29 29 WithoutSunday_4: invalid handle -1 in FileWriteDouble
2006.12.09 03:26:29 29 WithoutSunday_4: invalid handle -1 in FileWriteDouble
2006.12.09 03:26:29 29 WithoutSunday_4: invalid handle -1 in FileWriteDouble
2006.12.09 03:26:29 29 WithoutSunday_4: invalid handle -1 in FileWriteDouble
2006.12.09 03:26:29 29 WithoutSunday_4: invalid handle -1 in FileWriteInteger
2006.12.09 03:26:29 29 WithoutSunday_4: invalid handle -1 in FileSeek
2006.12.09 03:26:29 29 WithoutSunday_4: invalid handle -1 in FileFlush
2006.12.09 03:26:29 29 WithoutSunday_4: invalid handle -1 in FileWriteDouble
2006.12.09 03:26:29 29 WithoutSunday_4: invalid handle -1 in FileWriteDouble
2006.12.09 03:26:29 29 WithoutSunday_4: invalid handle -1 in FileWriteDouble
2006.12.09 03:26:29 29 WithoutSunday_4: invalid handle -1 in FileWriteDouble
2006.12.09 03:26:29 29 WithoutSunday_4: invalid handle -1 in FileWriteDouble
2006.12.09 03:26:29 29 WithoutSunday_4: invalid handle -1 in FileWriteInteger
2006.12.09 03:26:29 29 WithoutSunday_4: invalid handle -1 in FileSeek
2006.12.09 03:26:29 29 WithoutSunday_4 EURUSDm,Daily: Alert: FileOpenHistory("WS_AUDNZDm1440. hst", FILE_BIN | FILE_WRITE ) - Error #4102
2006.12.09 03:26:29: FileOpen - too many opened files
2006.12.09 03:26:29 29 WithoutSunday_4 EURUSDm,Daily: Alert: FileOpenHistory("WS_NZDJPYm1440. hst", FILE_BIN | FILE_WRITE ) - Error #4102
2006.12.09 03:26:29: FileOpen - too many opened files
2006.12.09 03:26:29 29 WithoutSunday_4 EURUSDm,Daily: Alert: FileOpenHistory("WS_AUDCADm1440. hst", FILE_BIN | FILE_WRITE ) - Error #4102
2006.12.09 03:26:29: FileOpen - too many opened files
2006.12.09 03:26:29:29 WithoutSunday_4 EURUSDm,Daily: Alert: FileOpenHistory("WS_EURCADm1440. hst", FILE_BIN | FILE_WRITE ) - Error #4102
2006.12.09 03:26:29: FileOpen - too many opened files
2006.12.09 03:26:29 29 WithoutSunday_4 EURUSDm,Daily: Alert: FileOpenHistory("WS_EURAUDm1440. hst", FILE_BIN | FILE_WRITE ) - Error #4102
2006.12.09 03:26:29: FileOpen - too many opened files
2006.12.09 03:26:29 29 WithoutSunday_4 EURUSDm,Daily: Alert: FileOpenHistory("WS_GBPCHFm1440. hst", FILE_BIN | FILE_WRITE ) - Error #4102
2006.12.09 03:26:29: FileOpen - too many opened files
*****************************

Usually, after it appears, I just restart the terminal and everything continues to work normally round the clock!
I'm just writing this for information and not for you to try to deal with the problem. I think you can't do without help from the developers.

I'm writing to you with the following request. The Expert Advisor for calculation of linear and parabolic regressions mentioned above in this branch works based on the quotes generated by this script. Regression calculations are based on averaged bar parameters, i.e. a value of (O+H+L+C)/4 is taken as a reference value. But judging from my long term observations, I suppose this model of (O+H+L+C)/4 readings is not quite successful. I place a stop for an order that is opened on the border of the 95% confidence level on the border of 99.9%. However, there were cases when the price exceeded the boundary of the 99.9% confidence interval by just a few pips. At the same time, the number of such cases is higher than the allowed value according to statistical data! That is why I really WANTED to check my assumption that if we take the model by High and Close as a basis for calculations, this limit will be statistically more accurate. The Expert Advisor is very bulky - 184kB in an mq4 file. There are many places where quotes are referenced. If I correct the EA for a new model, then apart from the fact that it is quite labour-intensive, there is a high probability of introducing errors in a quite complex calculation algorithm, which in my opinion is already well established and works reliably.

That is why I would like to ask you to improve the last version of the script so that it forms the quotes of H12 period from received daily candlesticks.
Bar H12 which opens at 00:00 should have the values O=H=L=C=Low of the initial daily bar.
H12 bar that opens at 12:00 should have values O=H=L=C=High of the initial daily bar.
Also, the Expert Advisor should be able to swap the values, i.e. H12 bar at 00:00 = High of the initial daily bar, H12 bar at 12:00 = Low of the initial daily bar.
During real-time chart updates, the Expert Advisor should pass the last H12 bar(s) of the current day without processing, i.e. with the current values of O,H,L,C for each H12 bar.
The described processing of bars should be done only after the daily candle closes, when there are no more changes in H12 bars of the closed day.
If you can help me improve the existing script according to the described method, it will VERY IMPROVE checking of the High-Low model in terms of statistical analysis of channel creation. I promise to present the results of comparisons here. I think it will be interesting for many people interested in statistical data processing to read them. THANK YOU in advance!!!

 
solandr:

InterbankFX is having some problems with the update (the invite to update appears, but the build is not downloaded - but that doesn't matter)

From the new real servers it really doesn't update. With liveupdate demo server it connects without problems.
 

For my part, I will first try to check the channel calculation for High only and Low only individually. I will see the results. If the channels obtained using different samples coincide in length, we can probably do without a new script for the H12 period. That is, we will use the data on High for the upper boundaries of the channels, and the data on Low for the lower boundaries. Maybe I am bothering you for nothing with my requests if everything can be solved much easier in my EA? I think it is not difficult to implement in my Expert Advisor.

 
komposter I'm having a problem here, can you tell me what to do? All the details are here http://forum.kimiv.ru/viewtopic.php?t=177
 
solandr:

I've noticed one small thing, which I assume is a feature of the terminal and not of the EA, which I personally have no complaints about! When Expert Advisor is running and I compile any EA in Metaeditor, which is not even attached to any of the charts, there is an error in the terminal logs.

Sorry I haven't replied for a long time - just got back from holiday...

The problem, it seems to me, is that EA doesn't close open files. The question is why it doesn't do that =)
The only assumption is that during compilation, the startup function of working EAs is stopped forcibly.

And at the next "start", the files are reopened, but there is "not enough space" (maximum 32 open files).

Expert Advisor itself does not handle this situation quite correctly - even if a file hasn't opened, it still tries to write data there.
Fixed it - added one line =)
if ( HistoryHandle[curChart] < 0 ) continue;


attached Expert Advisor.



Regarding H12 charts. "Got time but no money" is not about me =)
Although I too have these 2 values inversely related - the more free time, the less money and vice versa.

At the moment I can not do charity work - I have too much work.
And the forum is 5 pages (*30 topics) unread....
Files:
Reason: