MQL4 - automated forex trading   /  

Forum

Login | Register | Language: ru cn en
Have Something to Say to Traders? Welcome to Blogs!

How to hide bars of certain period of time?

Back to topics list To post a new topic, please log in or register
avatar
110
ricx 2010.11.05 12:04
 
My mt4 is using Eastern standard time so london opens at 4pm and close at 11.30pm what i want to do is to hide 11.31pm to 3.59pm bars how to do that??
 
Interaction between MеtaTrader 4 and MATLAB Engine (Virtual MATLAB Machine)
The article contains considerations regarding creation of a DLL library - wrapper that will enable the interaction of MetaTrader 4 and the MATLAB mathematical desktop package. It describes "pitfalls" and ways to overcome them. The article is intended for prepared C/C++ programmers that use the Borland C++ Builder 6 compiler.
avatar
Moderator
2029
gordon 2010.11.05 22:41 #
 
ricx:
My mt4 is using Eastern standard time so london opens at 4pm and close at 11.30pm what i want to do is to hide 11.31pm to 3.59pm bars how to do that??
Even if it's possible it would result in a large gap in the chart (between those hours), since the time axis is fixed (only scaling can be changed). I am guessing u don't want that...
 
avatar
9919
WHRoeder 2010.11.06 15:09 #
 
ricx:
My mt4 is using Eastern standard time so london opens at 4pm and close at 11.30pm what i want to do is to hide 11.31pm to 3.59pm bars how to do that??

Option one is to use offline charts and remove the periods. Search for Constant Range Bars and Renko Charts.

Option two is to simply draw a rectangle over the area

//+------------------------------------------------------------------+
//| Adjust variables for a new bar.                                  |
//+------------------------------------------------------------------+
double  Tokyo.channel.high, Tokyo.channel.low,                      // openNew
//      H.H,    L.L,    ATR.value;                                  // setDIR
void    NewBar(){
    /*++++ Tokyo Channel*/{                                         datetime
    TimeUTC             = Time[0] + Server.Time.To.UTC,
    TimeUTC0000         = TimeUTC - (TimeUTC) % 86400,              // 24*60*60
    TimeWellingtonOpen  = TimeUTC0000 + 79200 - Server.Time.To.UTC, // 22*60*60
    TimeNYmidnight      = TimeWellingtonOpen + 21600; /*6Hr 22..4 GMT*/
    while(                TimeNYmidnight      > Time[0]     // In the past only.
         || TimeDayOfWeek(TimeNYmidnight)     > 5           // Market is closed
         || TimeDayOfWeek(TimeWellingtonOpen) > 5 ){        // Saturdays
            TimeWellingtonOpen -= 86400;    TimeNYmidnight -= 86400;    }
    int TKcPeriod       = MathMin( PERIOD_H1, Period() ),
        TKcStart        = iBarShift(NULL,TKcPeriod, TimeWellingtonOpen),
        TKcEnd          = iBarShift(NULL,TKcPeriod, TimeNYmidnight-1),
        TKcLength       = TKcStart - TKcEnd + 1;
    Tokyo.channel.high  = High[Highest(NULL,TKcPeriod, MODE_HIGH, TKcLength, TKcEnd)];
    Tokyo.channel.low   =  Low[ Lowest(NULL,TKcPeriod, MODE_LOW,  TKcLength, TKcEnd)];
    if (Show.Objects){                                  #define WINDOW_MAIN 0
        static string   TKcRect = "Tokyo Channel";                             {
        if(!(ObjectMove(TKcRect, 0, TimeWellingtonOpen, Tokyo.channel.high)
          && ObjectMove(TKcRect, 1, TimeNYmidnight - 1, Tokyo.channel.low )))
            if (!ObjectCreate( TKcRect, OBJ_RECTANGLE, WINDOW_MAIN
                             , TimeWellingtonOpen, Tokyo.channel.high
                             , TimeNYmidnight - 1, Tokyo.channel.low))    Alert(
                "ObjectCreate(", TKcRect, "Rectangle) failed: ",GetLastError());
            else if (!ObjectSet( TKcRect, OBJPROP_COLOR, Color.TKc ))   Alert(
                "ObjectSet(", TKcRect, "Color) [1] failed: ", GetLastError()); }
        static string   TKcWell = "Wellington Opens";                          {
        if(!ObjectMove( TKcWell, 0, TimeWellingtonOpen, EMPTY ))
            if (!ObjectCreate( TKcWell, OBJ_VLINE, WINDOW_MAIN
                             , TimeWellingtonOpen, EMPTY))              Alert(
                "ObjectCreate(", TKcWell, "Vline) [1] failed: ",GetLastError());
            else if (!ObjectSet( TKcWell, OBJPROP_COLOR, Color.TKc ))   Alert(
                "ObjectSet(", TKcWell, "Color) [4] failed: ", GetLastError()); }
        static string   TKcNYMid= "NY Midnight";                               {
        if(!ObjectMove( TKcNYMid, 0, TimeNYmidnight, EMPTY ))
            if (!ObjectCreate( TKcNYMid, OBJ_VLINE, WINDOW_MAIN, TimeNYmidnight
                             , EMPTY))                                  Alert(
                "ObjectCreate(", TKcNYMid, "Vline) [2] failed: ",GetLastError());
            else if (!ObjectSet( TKcNYMid, OBJPROP_COLOR, Color.TKc ))  Alert(
                "ObjectSet(", TKcNYMid, "Color) [5] failed: ", GetLastError());}
    }
    /*---- Tokyo Channel*/}
 
avatar
110
ricx 2010.12.13 18:01 #
 

Thank you guys, i tried to write the code for this :)

http://forum.mql4.com/37482#404944

Back to topics list  

To add comments, please log in or register