Download MetaTrader 5
To add comments, please log in or register
Find out the most discussed Forum topics. Have a look at the Wall section!
polluxvic
20
polluxvic 2014.06.14 17:10 

Hello,


first excuse me for my bad english.


I have MT4 and the new renko 600 chart on the M1 live chart.For exemple, i use the generated renko on the offline chart M2,with an another EA on this offline M2 chart.

It work perfect !


But when my internet is disconnected temporaly , mt4 terminal is disconnected too (logic). Afer when internet is connected  mt4 is connected too.

But beetween the disconnection and the reconnection the EA Renko chart has not update the ticks and makes some gap on the M2 offline chart. So to update the missing ticks on M2 offline chart, I must redrop the EA renko 600 on the M1 live chart.


How can i automatize the process when i have a disconnection ? On every tick, the EA Renko 600 must update the same way that i drop manually the EA on the M1 chart to prevent disconnection.

I think, it must be change some thing in the begin of the program :


void UpdateChartWindow()
{
        if(hwnd == 0) {
                hwnd = WindowHandle(SymbolName, RenkoTimeFrame);
                if(hwnd != 0) Print("Chart window detected");
        }
        if(EmulateOnLineChart && MT4InternalMsg == 0) 
                MT4InternalMsg = RegisterWindowMessageW("MetaTrader4_Internal_Message");
        if(hwnd != 0) if(PostMessageW(hwnd, WM_COMMAND, 0x822c, 0) == 0) hwnd = 0;
        if(hwnd != 0 && MT4InternalMsg != 0) PostMessageW(hwnd, MT4InternalMsg, 2, 1);
        return;
polluxvic
20
polluxvic 2014.06.14 17:11  
but what ?
Halley
198
Halley 2014.06.14 18:33  
Probably the best approach is contacting the author, if he left his contact in the code. The part you reprinted has nothing in common with feed interrupts.
polluxvic
20
polluxvic 2014.06.14 20:47  

When I drop the EA renko on M1 chart, it calculte and convert apprammently in one time all the chart in M2 (but this process is once) and after it converts just the new tics, not enough to prevent the disconnection gap. 

If the programm calculate an once all the chart (when I drop it on the M1 chart), it's apparamently an variable who changes the first time, i believed what it was probably this code I posted, precisely the "hwnd" variable.

What the programm must do is to wait a new tic, and convert all the M1 chart, not to considere just the new tics.

polluxvic
20
polluxvic 2014.06.14 21:10  

Here is another part of the programmation, and it's writing :

" This is only executed once, then the first tick arives"



//
void UpdateChartWindow()
{
        if(hwnd == 0) {
                hwnd = WindowHandle(SymbolName, RenkoTimeFrame);
                if(hwnd != 0) Print("Chart window detected");
        }
        if(EmulateOnLineChart && MT4InternalMsg == 0) 
                MT4InternalMsg = RegisterWindowMessageW("MetaTrader4_Internal_Message");
        if(hwnd != 0) if(PostMessageW(hwnd, WM_COMMAND, 0x822c, 0) == 0) hwnd = 0;
        if(hwnd != 0 && MT4InternalMsg != 0) PostMessageW(hwnd, MT4InternalMsg, 2, 1);
        return;
}
//+------------------------------------------------------------------+
//
void OnInit(void)
{
   //Print("yep on init entered, hndl: " + HstHandle);
   //bStopAll = true;
   if(HstHandle > 0)
   {
      FileClose(HstHandle);
   }
   HstHandle = -1;
   return;
}
//
void OnTick(void)
{
        if(bStopAll) return;
        //Print("entered, hdl: " + HstHandle);
        
        //+------------------------------------------------------------------+
        // This is only executed once, then the first tick arives.
        if(HstHandle < 0) {
                // Init

                // Error checking       
                if(!IsConnected()) {
                        Print("Waiting for connection...");
                        return;
                }                                                       
                if(!IsDllsAllowed()) {
                        Print("Error: Dll calls must be allowed!");
                        bStopAll = true;
                        return;
                }               
                if(MathAbs(RenkoBoxOffset) >= RenkoBoxSize) {
                        Print("Error: |RenkoBoxOffset| should be less then RenkoBoxSize!");
                        bStopAll = true;
                        return;
                }
                switch(RenkoTimeFrame) {
                case 1: case 5: case 15: case 30: case 60: case 240:
                case 1440: case 10080: case 43200: case 0:
                        Print("Error: Invald time frame used for offline renko chart (RenkoTimeFrame)!");
                        bStopAll = true;
                        return;
                }
                //
                
                int BoxSize = RenkoBoxSize;
                int BoxOffset = RenkoBoxOffset;
                if(Digits == 5 || (Digits == 3 && StringFind(Symbol(), "JPY") != -1)) {
                        BoxSize = BoxSize*10;
                        BoxOffset = BoxOffset*10;
                }
                if(Digits == 6 || (Digits == 4 && StringFind(Symbol(), "JPY") != -1)) {
                        BoxSize = BoxSize*100;          
                        BoxOffset = BoxOffset*100;
                }
                
                if(StrangeSymbolName) SymbolName = StringSubstr(Symbol(), 0, 6);
                else SymbolName = Symbol();
                BoxPoints = NormalizeDouble(BoxSize*Point, Digits);
                PrevLow = NormalizeDouble(BoxOffset*Point + MathFloor(Close[Bars-1]/BoxPoints)*BoxPoints, Digits);
                DnWick = PrevLow;
                PrevHigh = PrevLow + BoxPoints;
                UpWick = PrevHigh;
                PrevOpen = PrevLow;
                PrevClose = PrevHigh;
                CurVolume = 1;
                PrevTime = Time[Bars-1];
        
                // create / open hst file               
                HstHandle = FileOpenHistory(SymbolName + RenkoTimeFrame + ".hst", FILE_BIN|FILE_WRITE|FILE_ANSI);
                if(HstHandle < 0) {
                        Print("Error: can\'t create / open history file: " + ErrorDescription(GetLastError()) + ": " + SymbolName + RenkoTimeFrame + ".hst");
                        bStopAll = true;
                        return;
                }
                else
                {
                   Print("History file opened for write, handle: " + HstHandle);
                   FileSeek(HstHandle, 0, SEEK_SET);
                   // Hist file opened as write zero length to create
                }
                // the file is created empty, now re-open it read write shared
                DoOpenHistoryReadWrite();
                FileSeek(HstHandle, 0, SEEK_SET);
                //Hist file opened as read write for adding to
                //
        //
                // write hst file header  -  does anyone have a structure for this heading?
                int HstUnused[13];
                FileWriteInteger(HstHandle, 401, LONG_VALUE);                   // Version  // was 400
                FileWriteString(HstHandle, "", 64);                                           // Copyright
                FileWriteString(HstHandle, SymbolName, 12);                     // Symbol
                FileWriteInteger(HstHandle, RenkoTimeFrame, LONG_VALUE);        // Period
                FileWriteInteger(HstHandle, Digits, LONG_VALUE);                // Digits
                FileWriteInteger(HstHandle, 0, LONG_VALUE);                        // Time Sign
                FileWriteInteger(HstHandle, 0, LONG_VALUE);                        // Last Sync
                FileWriteArray(HstHandle, HstUnused, 0, 13);                    // Unused
                //
                // process historical data
                int i = Bars-2;
                //Print(Symbol() + " " + High[i] + " " + Low[i] + " " + Open[i] + " " + Close[i]);
                //---------------------------------------------------------------------------
polluxvic
20
polluxvic 2014.06.15 04:07  

He has the same problem :


http://www.google.fr/url?sa=t&rct=j&q=&esrc=s&source=web&cd=4&cad=rja&uact=8&ved=0CEcQFjAD&url=http%3A%2F%2Fforums.babypips.com%2Fnewbie-island%2F41967-big-problem-im-having-mt4-renko-charts.html&ei=ahudU4HQIIWbPcrLgegD&usg=AFQjCNEadb1BkxGYvzp5CGhw3nJ6dt-YHg

Halley
198
Halley 2014.06.15 06:27  
polluxvic:

He has the same problem :

http://www.google.fr/url?sa=t&rct=j&q=&esrc=s&source=web&cd=4&cad=rja&uact=8&ved=0CEcQFjAD&url=http%3A%2F%2Fforums.babypips.com%2Fnewbie-island%2F41967-big-problem-im-having-mt4-renko-charts.html&ei=ahudU4HQIIWbPcrLgegD&usg=AFQjCNEadb1BkxGYvzp5CGhw3nJ6dt-YHg

 

If the script has an author, ask him, he knows better his script. Nobody in this forum will be willing to rebuild your complex script on your demand from code bits. Besides you may ask in job section, or choose one of numerous commercial Renko generators, like I did. I do not have such problems, because the tool has it in specification:

 

• it is an indicator rather than a script or EA, which makes it comfortable
• input setting is accessible from multiple places: input dialogue, entry on a feed chart, entry on the offline chart. Settings on the offline chart makes the range switching as simple as switching a timeframe.
• possible feed chart on-the-fly timeframe switching (no need to dedicate this chart for a feed)
• generator can break chart into sessions
• generator uses all available timeframes for the initial model, it is not bound to the selected timeframe
• estimates the offline chart starting point from the desired candle count
• a single indicator drives multiple identical offline charts, so you can run multiple EAs with a single generator
• detects interrupts in feed and rebuilds the offline chart after the feed reconnects
• displays correct candle tick volume, you may rely on the tick volume in your analysis or EA
• watches for a change of the feed server (lacking feature in MT4)
• works correctly with symbols having conflicting names (i.e. "EURUSD.." trailing double dot in name with a few brokers)
• reports unexpected time gaps in the MT4 history
• excludes phantom (no volume) ticks
• fixes incorrect input for a non-trivial instrument tick size
• can decrease chart refresh rate on demand
• indicator development is not closed, it has continuing support. You do not need to search Internet and pray volunteers for a fix. 

polluxvic
20
polluxvic 2014.06.15 12:38  

Thank you I will ask the autor !


Where can I buy the renko indicator what you gives ?

Uci Sanusi
7288
Uci Sanusi 2014.06.27 13:05  

I have Renkochart Renko and Rangebarchart EA  for MT4 build 646+. If you are interested, can contact me (blogteater@gmail.com )

new struct MqlRates:

 datetime time;         // Period start time

 double   open;         // Open price

 double   high;         // The highest price of the period

double   low;          // The lowest price of the period

double   close;        // Close price

long     tick_volume;  // Tick volume

 int      spread;       // Spread

 long     real_volume;  // Trade volume 


# Renkorangebarchart v646 for MT4 build 646+  (price= 100$)

rangebar 

 

#Renkochart Standard  (price= 80$)

 renkochart 646

Halley
198
Halley 2014.06.28 06:05  
blogteater:

I have Renkochart Renko and Rangebarchart EA  for MT4 build 646+. If you are interested, can contact me (blogteater@gmail.com )

new struct MqlRates:

 datetime time;         // Period start time

 double   open;         // Open price

 double   high;         // The highest price of the period

double   low;          // The lowest price of the period

double   close;        // Close price

long     tick_volume;  // Tick volume

 int      spread;       // Spread

 long     real_volume;  // Trade volume 


# Renkorangebarchart v646 for MT4 build 646+  (price= 100$)

 

 

#Renkochart Standard  (price= 80$)

 


How long did your chart stay disconnected before you took the screenshot?
/
To add comments, please log in or register