Passing variables from Indior to EA
Results 1 to 9 of 9

Thread: Passing variables from Indior to EA

  1. #1
    I am attempting to see it up where I could have an order opened up if it strikes an indior line

    I am wondering what is the best way to pass a buffer factor result to a factor in the EA? I've two indiors... each with 6 lines (each their particular buffer)....

    Therefore, if price = result; open trade... and opening just 1 trade per line.... I have 4 lines and if line 1 is hit, I do not want it to open another trade online 1... it could then hit line 2 and open a trade...

    line 0 is the guiding line, it is a moving average line
    online 1, open base size lot
    online 2, open base size lot *2
    online 3, open base size lot *3
    online 4, open base size lot*6
    online 5, shut the trade at end loss
    once it comes back to line 0, it is going to shut all transactions

    so if base size lot is .01... then it would open up a .01 trade, .02 trade, .03 trade, and a .06 trade.... Hence a lot size of .12 would be opened

    Also, I could use an array to store how many times each line has been hit for ratio functions, correct? And is there a way to start a clock when line 1 is hit until line 0 is hit? Therefore, measure how long it takes to return into the moving average line

  2. #2

  3. #3
    Double GlobalVariableGet (string name)

    so I would have to specify the variable as worldwide for the indior.... Utilize the GlobalVariableGet() in the EA, right?

    I have this variable in the Indior
    MA_Buffer[I] = iMA(NULL, 0, MA_Period, MA_Shift, MA_Method, MA_Applied_Price, I);

    dual GlobalVariableSet (line0, MA_Buffer[I] = iMA(NULL, 0, MA_Period, MA_Shift, MA_Method, MA_Applied_Price, I))

    I want to pass it along into the EA

    line0 = GlobalVariableGet(line0)


    Is this right?

  4. #4
    Within Indior:
    GlobalVariableSet(MyVariable, 12345.670);

    Within EA:
    double IndiorVariable = GlobalVariableGet(MyVariable);

    Do notice that you could just pass Double, strings not permitted.
    So you have to be inventive to compress your info into an actual (fractional) number.

  5. #5

    The buffers are dual variables so that should work

  6. #6
    Utilize the icustom function to extract data out of your indior. No requirement for global variables. As long as each line is an buffer it could be referenced with the icustom function.

  7. #7
    I second 's suggestion. You ought to avoid abusing global variables for such tasks. Do know that these variables that you set can be seen/used/set by another indior or EAs. Failure to control it is usage can be astrophic.

    Use iCustom to get the values in the custom indiors

    use International variables to store program state values perhaps for trade purpose after the weekend or even disaster recovery.


  8. #8

    therefore the indior is looping with several buffers....

    So when it comes to placing the open orders, I need to have something along the lines of:

    something to have a continued check on price to see whether it cross line 1 (do I need another bars counter at the EA?)

    There is a line 1 above and also a line 1 below.... So about the buy orders, I only have to be concerned about line 1 below.... On the market orders line 1 above

    when price = line 1 no open transactions on this line for this particular currency, open trade

    What would be the perfect method to plan this from pseudo into mq4 language?

    With language for one line, I should be able to handle all the Remaining lines

  9. #9
    Quote Originally Posted by ;
    Wow. These are resources that are excellent. I managed to obtain some sample EAs on the second source that shows how you can use Global Factors.

    Thank you for presenting those tools.

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 more information