Not logged in
Viewing 4 posts - 1 through 4 (of 4 total)
  • #235765 |
    Customer
    37 Posts

    Hi,

    I have the Divergence Indicator from Point Zero Trading.  It has some iCustom functionality.  Wondering how best to implement this code into an ea?

    //—- Define constants
    #define OP_REGULAR_BUY 0
    #define OP_REGULAR_SELL 1
    #define OP_HIDDEN_BUY 2
    #define OP_HIDDEN_SELL 3
    //—- Declare indicator type
    enum Indi_Type
    {
    RSI = 0, // RSI
    CCI = 1, // CCI
    MACD = 2, // MACD
    OSMA = 3, // OSMA (MACD Histogram)
    STOCH = 4, // Stochastic
    AWESOME = 5, // Awesome Oscillator
    ACCELERATOR = 6, // Accelerator Oscillator
    MOMENTUM = 7, // Momentum
    WILLIAMS = 8, // Williams Percent Range
    RVI = 9, // Relative Vigor Index
    MFI = 10, // Money Flow Index
    OBV = 11, // On Balance Volume
    };
    //—- Declare divergence type
    enum Div_Type
    {
    Regular_And_Hidden = 0,
    Regular = 1,
    Hidden = 2,
    };
    //+———————————————–+
    //| Custom indicator iteration function
    //+———————————————–+
    int start()
    {
    // Assign indicator to use
    Indi_Type type = AWESOME;
    // Assign divergence type
    Div_Type div = Regular_And_Hidden;
    // Declare breakout period
    int breakout_period = 2;
    // Read divergence
    double divergence = iCustom(Symbol(), Period(),
    “PZ_DivergenceTrading_LICENSE”,
    “–“, type, div, breakout_period, 5, 1);
    // Read breakout
    double breakout = iCustom(Symbol(), Period(),
    “PZ_DivergenceTrading_LICENSE”,
    “–“, type, div, breakout_period, 4, 1);
    // Actions on divergences (these can expand and repaint)
    if(divergence == OP_REGULAR_BUY) { /* Your code for regular bullish divergence */ }
    if(divergence == OP_REGULAR_SELL) { /* Your code for regular bearish divergence */ }
    if(divergence == OP_HIDDEN_BUY) { /* Your code for hidden bullish divergence */ }
    if(divergence == OP_HIDDEN_BUY) { /* Your code for hidden bearish divergence */ }
    // Actions on breakouts (these almost never repaint)
    if(breakout == OP_BUY) { /* Your code for bullish breakout (blue arrow) */}
    if(breakout == OP_SELL) { /* Your code for bearish breakout (red arrow) */}
    // Exit
    return(0);
    }

    Thanks,

    mkjones320

    #235770
    tomas262
    Administrator
    1826 Posts

    Can you share the ex4 or mq4 for the Wizard setup?

    #235779
    Customer
    37 Posts

    Here you go.  I started to define some parameters for it.  Not sure if I was headed the right way or not.

    Attachments:
    You must be logged in to view attached files.
    #235834
    tomas262
    Administrator
    1826 Posts

    This custom indicator seems to be incompatible. It gives unknown return type error on the import. Do you have any other version?

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.