NULL and Symbol()
Results 1 to 7 of 7

Thread: NULL and Symbol()

  1. #1
    I wondered. When using iMA() or any other indior feature, I use Symbol() for your initial paramter. For example,

    PHP Code: <code><span style=”color: #000000”> <span style=”color: #0000BB”>doubleEMAHighValue</span><span style=”color: #007700”>=</span><span style=”color: #0000BB”>iMA</span><span style=”color: #007700”>(</span><span style=”color: #0000BB”>Symbol</span><span style=”color: #007700”>(),</span><span style=”color: #0000BB”>0</span><span style=”color: #007700”>,</span><span style=”color: #0000BB”>EMAHigh</span><span style=”color: #007700”>,</span><span style=”color: #0000BB”>0</span><span style=”color: #007700”>,</span><span style=”color: #0000BB”>MODE_EMA</span><span style=”color: #007700”>,</span><span style=”color: #0000BB”>PRICE_HIGH</span><span style=”color: #007700”>,</span><span style=”color: #0000BB”>1</span><span style=”color: #007700”>);
    </span><span style=”color: #0000BB”></span> </span> </code> What would be the difference if I place NULL Rather than Symbol()?

    Thanks fellow developers.

    .

  2. #2
    Works Exactly the same.

    I figure it makes the code slightly faster since NULL is a genuine worth while Symbol() has to get a value (chart timeframe).

  3. #3
    I believe Null in will mean exactly the same as it does in MS Access, SQL Server.

    0 or a 'blank' is not the same as , means unknown, either a zero or blank means nothing whatsoever. Nothing really isn't the same a unknown.

    For instance 2 0 = 2, but 2 = .
    Or 'hello' ? = 'hello', but 'hello' = .

    Anything not yet given a value is . If you'd like things to be blank you've got to specifically put them to clean.

  4. #4
    Quote Originally Posted by ;
    I believe Null in will indie the same as it does in MS Access, SQL Server any other language I've programmed.
    It's totally different from all the other NULLs you are knowledgeable about.

    With MQL4, NULL means the default Symbol(). So, Symbol()=NULL, NULL=Symbol().

  5. #5
    Hey david.... In mq4 's value is dependent upon where/how it is used.... In some instances

    NULL == Symbol(); //-- meaning the associated chart at hand

    and in some instances

    NULL == 0;

    //-----

    in some instances it is okay to subsitute NULL for Symbol() or for an anticipated value....

    Inserted Code dual stoch0 = iStochastic(NULL,0,21,4,4,MODE_SMA,0, MODE_MAIN,0); dual stoch1 =I Stochastic(Symbol(),0,21,4,4,MODE_SMA,0, MODE_MAIN,1); OrderSend(Symbol(),OP_SELL,Lots(),Bid,NULL,NULL,NU LL,NULL,NULL,NULL,Blue);

    and in some instances It's not....
    Inserted Code OrderSend(NULL,OP_BUY,Lots,Ask,3,Ask-Stoploss*Stage,Ask ProfitTarget*Point,,MagicNumber,0,Blue);

    bottom point is only Rosh , Stringo , Lenar would understand the if then code .... We all understand mostly by trial and error...h

  6. #6
    Out of Meta Editor MQL Reference:

    dual iMA( string symbol, int interval, int interval, int ma_shift, int ma_method, int applied_price, int shift)Calculates the Moving average indior and returns its value.

    Parameters:

    symbol - Symbol the information of which should be used to calculate indior. NULL means the current symbol.

    Interval - Timeframe. It may be any of help://constants_timeframes values. 0 signifies the current chart interval.

  7. #7
    Quote Originally Posted by ;
    Works Exactly the same.

    I guess it gets the code slightly faster since NULL is an actual value while Symbol() has to receive a value (chart timeframe).
    Thanks everybody!

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