Announcement

Collapse
No announcement yet.

Combined Indicator

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Combined Indicator

    Dear All Members,
    Dear All Moderators,

    Some syntax help needed.

    For any time frame displayed.

    I try to create an indicator that display a blue histogram (in the first lower panel) everytime that the current candle/barchart (whatever the time frame) of the displayed stock or indice meets a certain number of criteria.

    For three of them, I can not get the write syntax and therefore need some help. Very simple.

    Don't try to define variables and their initial values, please just give me the right syntax.

    1. TrueBody >= ATR(21)*2.00 ... meaning ... this is a quite long candle compared to the historical last 21 candles;

    2. TrueBody is >= Total Range*0.80 ... meaning ... this is an ACCELERATION CANDLE (UpTrend Candle with Close near High or, if DownTrend Candle, Close near Low);

    3. Current Candle with Bollinger Normalized Volume >= 200.


    I wrote these conditions as follows but it seems that it does not work :

    var vTotalRange = null;
    var vTrueBody = null;
    var vATR21 = null;
    var vBolNormVol = null;

    function main(....){

    var vOpen = getValue("open", 0);
    var vHigh = getValue("high", 0);
    var vLow = getValue("low", 0);
    var vClose = getValue("close", 0);

    var vTotalRange = Math.abs (vHigh - vLow);
    var vTrueBody = Math.abs (vClose - vOpen);

    var vATR21 = atr(21);

    var vBolNormVol = efsExternal "/Bollinger/Bollinger Normalized Volume.efs"); //This assumes that the called function Bollinger Normalized Volume is in the same folder

    /* Conditions to be met if alert is to be displayed by a blue histogram between 0 and 1 in first lower panel */

    ... other conditions preceding that works ...

    /* Condition 3.1. : LONG Candle/Barchart AND Acceleration Candle/Barchart */

    && vTrueBody >= vATR21*2.00
    && vTrueBody >= vTotalRange*0.80

    ... other conditions in between that works ...

    /* Condition 3.4 : this candle presents at least a 200 % Bollinger Normalized Volume */

    && vBolNormVol >= 200

    }

    {var vPlot = 1;

    return vPlot; ... simply draw a histogram line between 0 and 1 value in the first lower panel if all preceeding conditions are met ...

    }

    Can you help me.

    Your sincerely,

    Olivier Balhan

  • #2
    Olivier
    The only issue that I can see from the portions of code that you posted is that you are declaring some variables as both global and local.
    If fixing that does not resolve the issue then I would suggest that you step through your script line by line using debugPrintln() to identify which variable is not returning the desired results and where that is happening and work your back from there. Also see the debugging process described by JasonK in this post.
    Alex

    Comment

    Working...
    X