EA on offline charts

 

Hi everyone,

I'm currently using a renko chart generator to generate a 4M offline timeframe.

I recently had some trouble coding (and using) a certain indicator on this offline chart; It seemed that for every new tick the IndicatorCounted() value was 0.

My question: the next few days I'm going to develop an EA that should be able to function on these kind of offline charts. Is there anything that I have to keep in mind while coding an EA for these offline charts? Any weird behaviour (comparable to the indicatorcounted issue for indicators) that I should know about before I start coding? Or is the development process exactly the same as for "normal" EA's?

I searched through the forum but did not find much useful information. However, I read a post that mentioned that the start function of an EA does not get called on every tick when using offline charts?? Any people have experience with this?

Thank you!

 

If the generator is posting the refresh (the Indicator is updating) so will the EA.

Since it's an offline chart Time[], Volume[] may not be valid (depending on the generator) and Period() certainly won't be.

Also Bid and Ask are bogus and you can't open orders on the chart. You will have use MarketInfo(realPair, MODE_ASK) and OrderSend(realPair, ..) not OrderSend(Symbol(), ..)


The alternative is to have the EA generate an internal Renko/Range bar chart into internal arrays. Gets rid of the offline kludge and trade problems (Time[]/Ask/Symbol.) But you can't visualize the chart and you have to internalize all indicators to run off the arrays.
 

I've searched through and this seems to be the only article talking trading on offline Renko chart.

I've spent weeks in making Renko work and I've backtested a lot in offline chart. And today I first time try to demo trade but can't get it work with the journal saying series of "HistoryBase: 12 errors in 'EURUSE2'. Then I read this article and I'm devastated.

Hi WHRoeder, could you please advise what do you mean by "You will have use MarketInfo(realPair, MODE_ASK) and OrderSend(realPair, ..) not OrderSend(Symbol(), ..)"? Can I trade by following this? Could you please show some sample code?

The other alternative that you mention is definitely too difficult for me.

 
lingwuchung:

I've searched through and this seems to be the only article talking trading on offline Renko chart.

I've spent weeks in making Renko work and I've backtested a lot in offline chart. And today I first time try to demo trade but can't get it work with the journal saying series of "HistoryBase: 12 errors in 'EURUSE2'. Then I read this article and I'm devastated.

Hi WHRoeder, could you please advise what do you mean by "You will have use MarketInfo(realPair, MODE_ASK) and OrderSend(realPair, ..) not OrderSend(Symbol(), ..)"? Can I trade by following this? Could you please show some sample code?

The other alternative that you mention is definitely too difficult for me.

Your Broker doesn't know what Symbol EURUSE2 is . . so how can they give you Bid or Ask for that symbol ? so instead you use Market info with the real symbol name, perhaps "EURUSD" in this case ? . . . that gets you your Bid and Ask prices and all the other MarketInfo you might need . . . when you send an order you need to explicitly give the correct Symbol name, you can't use Symbol(), you must use, in this case "EURUSD".
 

You should also bear in mind that bars will have various timestamps. This may be the bar opening time or the bar closing time depending upon the exact renko chart generator version you are using.

If any of your code uses bartimes for looping, it can cause problems.

 
RaptorUK:
Your Broker doesn't know what Symbol EURUSE2 is . . so how can they give you Bid or Ask for that symbol ? so instead you use Market info with the real symbol name, perhaps "EURUSD" in this case ? . . . that gets you your Bid and Ask prices and all the other MarketInfo you might need . . . when you send an order you need to explicitly give the correct Symbol name, you can't use Symbol(), you must use, in this case "EURUSD".

Opss. "EURUSE2" is a typo. It should be "EURUSD2". I change to use OrderSend("EURUSD", .....) (you're correct, I used Symbol() before) but I am still seeing this "HistoryBase: 21 erros in 'EURUSD2'" messages in the journal, seems for every tick.

 

And it is strange that the "init()" messages could be displayed but the "start()" is never entered as the Print message doesn't show up in the Experts tab.

int init()
{
   string s="";
   int i=0, t=0;  
      
   Print("------------------------- Start of program (init) -------------------------");   

 
// cut some code
   


   Print("------------------------- End of program (init) -------------------------");   
   
   return(0);
}


//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start() {
     
Print("start 01");
   
   if(Bars < 100) {
      myPrint(2, "bars less than 100");
      return(0);
 
Hi Dear all, any help? Thanks!
 

Hi RaptorUK,

If I can get this fixed, will I not need to "generate an internal Renko/Range bar chart into internal arrays." as what WHRoeder said? Many thanks!

 
lingwuchung:

Hi RaptorUK,

If I can get this fixed, will I not need to "generate an internal Renko/Range bar chart into internal arrays." as what WHRoeder said? Many thanks!

I don't think so, after all he did say it was an alternative . . .
 
William Roeder #:

If the generator is posting the refresh (the Indicator is updating) so will the EA.

Since it's an offline chart Time[], Volume[] may not be valid (depending on the generator) and Period() certainly won't be.

Also Bid and Ask are bogus and you can't open orders on the chart. You will have use MarketInfo(realPair, MODE_ASK) and OrderSend(realPair, ..) not OrderSend(Symbol(), ..)


The alternative is to have the EA generate an internal Renko/Range bar chart into internal arrays. Gets rid of the offline kludge and trade problems (Time[]/Ask/Symbol.) But you can't visualize the chart and you have to internalize all indicators to run off the arrays.

How am I supposed to do that last part? I've thought of how to do it, but don't know how to implement it.


My thinking:
Renko creates the chart, an indicator is then applied to the chart, a expert then advises renko to place orders based on indicator (Is this the right way to think?)

Reason: