Minor Indior Tweak / Code Review: Hotkeys_Slim
Results 1 to 7 of 7

Thread: Minor Indior Tweak / Code Review: Hotkeys_Slim

  1. #1
    Hi all

    that I could use a bit of a favour.

    I use this indior on a daily basis to quickly change time frames, however whenever there's any order direction EA attached to the chart, MT4 freezes up for a few seconds.

    Is there anything in this code which would lead to MT4 to lock if there's an EA attached?

    I can happily blast through the time frames usually using all the EA's attached to the chart without issue. It's definitely a thing to do with this code.

    Any thoughts will be fantastic.

    Cheers
    https://www.forexforum.co.za/attachm...1631763885.ex4
    https://www.forexforum.co.za/attachm...5281204519.mq4

  2. #2
    Sounds like a plan. I can not trade without a ridiculous amount of time-frame leaping so will stick with Hotkeys_Slim.

  3. #3
    Quote Originally Posted by ;
    Hi all I could use a bit of a favour. I utilize this indior on a daily basis to rapidly change time frames, but if there is any order direction EA attached to the chart, MT4 freezes up for a few seconds. Can there be anything in this code which would lead to MT4 to lock if there is an EA attached? I can happily blast throughout the time frames normally with the EA's attached to the chart without any issue. It's definitely a thing to do with this code. Any ideas would be great. Cheers file file
    There is one important thing you really must comprehend about MT, and that's all about MT progr (EA, indi, etc.) can only operate on a chart instances, and if you change a chart's timeframe it's exactly the exact same thing as closing and reopening the chart and reapplying your progr. This means that all app get reinitialized, and that is why you're getting errors. This is incredibly dangerous unless you have assembled a super rock-solid EA that may recover and handle errors, and even then you shouldn't be changing messing with all the running example of an EA.

    In summary, if you're using someone else's EA and you don't have/understand the source code then under no circumstances if you never change the chart, and if you're running your own recovery system then.... You really don't change the freakin' chart!!! Only mess with charts which do not have active EAs.

  4. #4
    Quote Originally Posted by ;
    attempt today. file file
    Cheers, did not fix the issue but I will see the tweaks made sense to test. Much appreciated.

    It has to be precisely the way this indior works causing difficulties with a few EAs I suppose...

  5. #5

  6. #6
    Ok found a workaround with another script I can map to hotkeys to change a timeframe on a single chart only.

    Just one problem, the way to get rid of this pop up when applying this to a chart?
    https://www.forexforum.co.za/attachm...6841059158.mq4
    https://www.forexforum.co.za/attachm...1478638277.ex4

  7. #7
    Here Is the code. It seems fairly basic but there's something inducing MT4 to crash whenever there's an EA connected to the chart.

    // ------------------------------------------------------------------
    //| hotKeys.mq4 |
    //| Twist 2015, Mohit Marwaha |
    //| |
    // ------------------------------------------------------------------
    #property copyright Copyright 2015, Mohit Marwaha
    #property link
    #property variant 1.00
    #property stringent
    #property indior_chart_window
    #property description
    #property description The indior will change the length of the chart with key media
    #property description M - Monthly, W - Weekly, D - Daily, 4 - 4Hr, 1 - 1Hr, 3 - 30Mins, f - 15Mins, 5 - 5Mins
    #define KEY_MONTHLY 57
    #define KEY_WEEKLY 56
    #define KEY_DAILY 55
    #define KEY_4HOUR 54
    #define KEY_1HOUR 53
    #define KEY_5MIN 50
    #define KEY_30MIN 52
    #define KEY_15MIN 51
    #define KEY_1MIN 49
    #define KEY_CHARTFIX 48
    #define KEY_P 80
    // ------------------------------------------------------------------
    //| Custom indior initialization function |
    // ------------------------------------------------------------------
    int OnInit()

    //--
    yield (INIT_SUCCEEDED);

    // ------------------------------------------------------------------
    //| Custom indior iteration function |
    // ------------------------------------------------------------------
    int OnCalculate(const int rates_total,
    const int prev_calculated,
    const datetime timing [],
    const double open[],
    const double top [],
    const double low[],
    const double shut [],
    const extended tick_volume[],
    const long volume[],
    const int spread[])

    yield (rates_total);

    // ------------------------------------------------------------------
    //| ChartEvent function |
    // ------------------------------------------------------------------
    emptiness OnChartEvent(const int id,
    const long lparam,
    const dual dparam,
    const series sparam)

    //--
    if(id==CHARTEVENT_KEYDOWN)

    switch(int(lparam))

    instance KEY_MONTHLY:ChartSetSymbolPeriod(0,NULL,43200);
    break;
    instance KEY_WEEKLY:ChartSetSymbolPeriod(0,NULL,10080);
    break;
    instance KEY_DAILY:ChartSetSymbolPeriod(0,NULL,1440);
    break;
    instance KEY_4HOUR:ChartSetSymbolPeriod(0,NULL,240);
    break;
    instance KEY_1HOUR:ChartSetSymbolPeriod(0,NULL,60);
    break;
    instance KEY_5MIN:ChartSetSymbolPeriod(0,NULL,5);
    break;
    instance KEY_30MIN:ChartSetSymbolPeriod(0,NULL,30);
    break;
    instance KEY_15MIN:ChartSetSymbolPeriod(0,NULL,15);
    break;
    instance KEY_1MIN:ChartSetSymbolPeriod(0,NULL,1);
    break;
    instance KEY_CHARTFIX:

    bool isFixed=ChartGetInteger(0,CHART_SCALEFIX,true);
    if(! IsFixed)

    ChartSetInteger(0,CHART_SCALEFIX,true);

    else

    ChartSetInteger(0,CHART_SCALEFIX,false);


    break;
    instance KEY_P:

    bool isFixed=ChartGetInteger(0,CHART_SHOW_PRICE_SCALE,t rue);
    if(! isFixed)

    ChartSetInteger(0,CHART_SHOW_PRICE_SCALE,true);

    else

    ChartSetInteger(0,CHART_SHOW_PRICE_SCALE,false);


    break;

    ChartRedraw();


    // ------------------------------------------------------------------
    int deinit()

    return(0);

    // ------------------------------------------------------------------

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
This website uses cookies
We use cookies to store session information to facilitate remembering your login information, to allow you to save website preferences, to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners.