MT4 store values into Global Variables
Results 1 to 7 of 7

Thread: MT4 store values into Global Variables

  1. #1
    Tknatutesn90
    Guest
    Hello,

    Could someone be so kind to reveal how a custom made indior or EA?
    Would compose indior values to MT4's global variables

    basicly what I need is
    shop the previous 3 fractal values to global variables
    shop the 5,20,50 MA value into global variables
    shop the previous bar high, low into international variables

    Your help is highly apreiciated

    Thanks!

  2. #2
    Tknatutesn90
    Guest
    Thanks for the heads up
    I don't know anything about coding
    perhaps you could show me a very simple indior I could use to some chart
    that would'export' a 5ma value to the global variables
    and I could see how it's performed

    thanks !

  3. #3
    I believed you had the fundamental skills of programming. What you are attempting is way too much for a non programmer. My explanation would not make any sense and I don't mean to write a tutorial.

  4. #4
    Hey nico.... Have a look at http://codebase.mql4.com/source/4856 for an illuion of the way globals ' are'set','get' and'delete'....

    A stripped down to nothing code example below.... It will put the values in the worldwide list...h

    //--
    //--

    Inserted Code #property indior_chart_window // -- int init() return(0); // -- int deinit() return(0); // -- int start() int counted_bars=IndiorCounted(); //-- GlobalVariableSet(high,High#91;1#93;-RRB-; GlobalVariableSet(low,Low#91;1#93;-RRB-; GlobalVariableSet(five ma,iMA(NULL,0, 5,0,0,0,1)); GlobalVariableSet(twenty ma,iMA(NULL,0,20,0,0,0,1)); GlobalVariableSet(fifty ma,iMA(NULL,0,50,0,0,0,1)); //-- return(0); // ------------------------------------------------------------------

  5. #5
    Tknatutesn90
    Guest
    Hayseed,

    many thanks, this really is all I needed
    simply writing worth to GV,
    another app will use these values to upgrade my SL

    Thanks again!

  6. #6
    Quote Originally Posted by ;
    Hayseed,

    many thanks, this really is all I wanted
    simply writing worth to GV,
    another program may use these values to update my SL

    Thanks again!
    Nico, realize there is much, much more to it than just simply setting a value to global var... you need to let it recover the value, reset the worth and so on.

    Hayseeds illuion is quite basic beginning point. Globals can be very difficult for a newbie to get head around.

    Your best choice is to find sample code and then play with it. The longer code you seem the better you'll get at it. But it's not easy for newbie.

    Programming is much more or less looking backwards because code runs top to bottom on each tick. You need to put things this natural order or your code is basically not efficient when it requires more than one tick to do all functions it should.

    Programming loops will kill it. In case it gets stuck in a loop it will not do anything. Quite easy to do with establishing and receiving global factors. You need to think and plan these things very well and ensure there are no loops to get stuck in.

  7. #7
    Global Variables are very simple to use. What you're trying is possible but requires some planning to prevent issues with the shortcomings of International Variables. First of all, you want to come up with a fantastic naming scheme should you would like to keep that data differently you will never figure out what has to be changed later. You should probably have separate vars for every pair and have the emblem as part of the name.

    Second - globals only accept numeric values, no alphabetic characters. From the description you'll avoid that limitation.

    Third - keep the amount of accesses to a minimum as this will improve functionality. I typically create/read the value at Init() period and update the value at Deinit() time.

    I am not supplying any code samples. The code I've written is very complied and the logic is difficult to follow. Plus my use was very different to everything you would like.

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.