FXCM Forex Trading

15 popular candle patterns

Here you can post and download custom indicators. PLEASE: Do not start topics unless you are posting your own indicator, they will be moved to appropriate section even if you do.

Moderator: admin

Re: 15 popular candle patterns

Postby Checkz » Wed Sep 29, 2010 9:12 pm

I was wondering why the new patterns don't show up on the chart. I downloaded the second version with the morning and evening star, etc. patterns but they don't show up on the screen.
Checkz
 
Posts: 27
Joined: Tue Sep 07, 2010 3:27 pm

Re: 15 popular candle patterns

Postby richardtao » Thu Sep 30, 2010 8:41 pm

i would like to shared my indicator, but it seems i had no authority to post.
how can i post a new indicator?
thx.
richardtao
FXCodeBase: Confirmed User
 
Posts: 92
Joined: Sun Jun 27, 2010 11:38 pm
Location: Taipei, Taiwan

Re: 15 popular candle patterns

Postby Apprentice » Thu Sep 30, 2010 11:51 pm

I do not have permission to do something more, but if you
Send the indicator through the mail to me.
So I could get it published.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 16525
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: 15 popular candle patterns

Postby Nikolay.Gekht » Fri Oct 01, 2010 1:29 pm

richardtao wrote:i would like to shared my indicator, but it seems i had no authority to post.
how can i post a new indicator?
thx.

I updated your profile, so now you can. Please try.
Nikolay.Gekht
FXCodeBase: Base Builder
 
Posts: 1222
Joined: Wed Dec 16, 2009 6:39 pm
Location: Cary, NC

Re: 15 popular candle patterns

Postby richardtao » Wed Oct 06, 2010 8:46 pm

Nikolay.Gekht wrote:
richardtao wrote:i would like to shared my indicator, but it seems i had no authority to post.
how can i post a new indicator?
thx.

I updated your profile, so now you can. Please try.


apply group succeed. thanks!
richardtao
FXCodeBase: Confirmed User
 
Posts: 92
Joined: Sun Jun 27, 2010 11:38 pm
Location: Taipei, Taiwan

Re: 15 popular candle patterns

Postby Alexander.Gettinger » Fri Oct 22, 2010 12:45 am

Other version of this indicator.

Pattern4.png


Code: Select all
function Init()
    indicator:name("Candle Pattern 4");
    indicator:description("");
    indicator:requiredSource(core.Bar);
    indicator:type(core.Oscillator);

    indicator.parameters:addInteger("EQ", "Maximum of pips distance between equal prices", "", 1, 0, 100);
    indicator.parameters:addBoolean("PAT_DOUBLE_INSIDE", "Enable Double Inside", "", true);
    indicator.parameters:addBoolean("PAT_INSIDE", "Enable Inside", "", true);
    indicator.parameters:addBoolean("PAT_OUTSIDE", "Enable Outside", "", true);
    indicator.parameters:addBoolean("PAT_PINUP", "Enable Pin Up", "", true);
    indicator.parameters:addBoolean("PAT_PINDOWN", "Enable Pin Down", "", true);
    indicator.parameters:addBoolean("PAT_PPRUP", "Enable Pivot Point Reversal Up", "", true);
    indicator.parameters:addBoolean("PAT_PPRDN", "Enable Pivot Point Reversal Down", "", true);
    indicator.parameters:addBoolean("PAT_DBLHC", "Enable Double Bar Low With A Higher Close", "", true);
    indicator.parameters:addBoolean("PAT_DBHLC", "Enable Double Bar High With A Lower Close", "", true);
    indicator.parameters:addBoolean("PAT_CPRU", "Enable Close Price Reversal Up", "", true);
    indicator.parameters:addBoolean("PAT_CPRD", "Enable Close Price Reversal Down", "", true);
    indicator.parameters:addBoolean("PAT_NB", "Enable Neutral Bar", "", true);
    indicator.parameters:addBoolean("PAT_NB2", "Enable 2 Neutral Bars", "", true);
    indicator.parameters:addBoolean("PAT_FBU", "Enable Force Bar Up", "", true);
    indicator.parameters:addBoolean("PAT_FBD", "Enable Force Bar Down", "", true);
    indicator.parameters:addBoolean("PAT_MB", "Enable Mirror Bar", "", true);
    indicator.parameters:addBoolean("PAT_HAMMER", "Enable Hammer", "", true);
    indicator.parameters:addBoolean("PAT_SHOOTSTAR", "Enable Shooting Star", "", true);
    indicator.parameters:addBoolean("PAT_EVSTAR", "Enable Evening Star", "", true);
    indicator.parameters:addBoolean("PAT_MORNSTAR", "Enable Morning Star", "", true);
    indicator.parameters:addBoolean("PAT_EVDJSTAR", "Enable Evening Doji Star", "", true);
    indicator.parameters:addBoolean("PAT_MORNDJSTAR", "Enable Morning Doji Star", "", true);
    indicator.parameters:addBoolean("PAT_BEARHARAMI", "Enable Bearish Harami", "", true);
    indicator.parameters:addBoolean("PAT_BEARHARAMICROSS", "Enable Bearish Harami Cross", "", true);
    indicator.parameters:addBoolean("PAT_BULLHARAMI", "Enable Bullish Harami", "", true);
    indicator.parameters:addBoolean("PAT_BULLHARAMICROSS", "Enable Bullish Harami Cross", "", true);
    indicator.parameters:addBoolean("PAT_DARKCLOUD", "Enable Dark Cloud Cover", "", true);
    indicator.parameters:addBoolean("PAT_DOJISTAR", "Enable Doji Star", "", true);
    indicator.parameters:addBoolean("PAT_ENGBEARLINE", "Enable Engulfing Bearish Line", "", true);
    indicator.parameters:addBoolean("PAT_ENGBULLLINE", "Enable Engulfing Bullish Line", "", true);
   
    indicator.parameters:addGroup("Style");
    indicator.parameters:addColor("Color1", "Color 1 for map", "", core.rgb(0, 255, 0));
    indicator.parameters:addColor("Color2", "Color 2 for map", "", core.rgb(255, 0, 0));
    indicator.parameters:addColor("Color3", "Color 3 for map", "", core.rgb(0, 0, 255));
    indicator.parameters:addColor("LblColor", "Color for pattern labels", "", core.COLOR_LABEL);
end

local source;
local P;
local EQ;

local PatternsArray={};
local Outs={};
local L = {};
local AllPatterns;
local i,Count;
local dummy;
local host;

function Prepare()
    EQ = instance.parameters.EQ * instance.source:pipSize();
    source = instance.source;
    host = core.host;
    InitPattern(source);
    PatternsArray[1]="PAT_DOUBLE_INSIDE";
    PatternsArray[2]="PAT_INSIDE";
    PatternsArray[3]="PAT_OUTSIDE";
    PatternsArray[4]="PAT_PINUP";
    PatternsArray[5]="PAT_PINDOWN";
    PatternsArray[6]="PAT_PPRUP";
    PatternsArray[7]="PAT_PPRDN";
    PatternsArray[8]="PAT_DBLHC";
    PatternsArray[9]="PAT_DBHLC";
    PatternsArray[10]="PAT_CPRU";
    PatternsArray[11]="PAT_CPRD";
    PatternsArray[12]="PAT_NB";
    PatternsArray[13]="PAT_NB2";
    PatternsArray[14]="PAT_FBU";
    PatternsArray[15]="PAT_FBD";
    PatternsArray[16]="PAT_MB";
    PatternsArray[17]="PAT_HAMMER";
    PatternsArray[18]="PAT_SHOOTSTAR";
    PatternsArray[19]="PAT_EVSTAR";
    PatternsArray[20]="PAT_MORNSTAR";
    PatternsArray[21]="PAT_EVDJSTAR";
    PatternsArray[22]="PAT_MORNDJSTAR";
    PatternsArray[23]="PAT_BEARHARAMI";
    PatternsArray[24]="PAT_BEARHARAMICROSS";
    PatternsArray[25]="PAT_BULLHARAMI";
    PatternsArray[26]="PAT_BULLHARAMICROSS";
    PatternsArray[27]="PAT_DARKCLOUD";
    PatternsArray[28]="PAT_DOJISTAR";
    PatternsArray[29]="PAT_ENGBEARLINE";
    PatternsArray[30]="PAT_ENGBULLLINE";
   
    AllPatterns=FindNumberPattern("");
   
    Count=0;
    for i=1,30,1 do
     if instance.parameters:getBoolean(PatternsArray[i])==true then
      Count=Count+1;
      L[Count]=PatternsArray[i];
      if math.fmod(Count,3)==1 then
       Outs[Count]=instance:createTextOutput (PatternsArray[i], PatternsArray[i], "Wingdings", 10, core.H_Center, core.V_Bottom, instance.parameters.Color1, 0);
      elseif math.fmod(Count,3)==2 then
       Outs[Count]=instance:createTextOutput (PatternsArray[i], PatternsArray[i], "Wingdings", 10, core.H_Center, core.V_Bottom, instance.parameters.Color2, 0);
      else
       Outs[Count]=instance:createTextOutput (PatternsArray[i], PatternsArray[i], "Wingdings", 10, core.H_Center, core.V_Bottom, instance.parameters.Color3, 0);
      end
     end
    end

    local name;
    name = profile:id();
    instance:name(name);
    dummy = instance:addStream("D", core.Line, name .. ".D", "D", instance.parameters.LblColor, 20);
    dummy:addLevel(0);
    dummy:addLevel(20*AllPatterns);
end

function FindNumberPattern(Pat)
 local Count=0;
 local i;
 local Fl=true;
 for i=1,30,1 do
  local Param=instance.parameters:getBoolean(PatternsArray[i]);
  if Fl==true then
   if Param==true then
    Count=Count+1;
   end
  end
  if PatternsArray[i]==Pat then
   Fl=false;
  end
 end
 return Count;
end

local prevSerial = nil;

function Update(period, mode)
    if period == 0 then
        prevSerial = source:serial(period);
    else
        if prevSerial ~= source:serial(period) then
            prevSerial = source:serial(period);
            UpdatePattern(period - 1);
        end
    end
   
    if period == source:size() - 1 then
        for i = 1, AllPatterns, 1 do
            host:execute("drawLabel", i, source:date(period), (AllPatterns + 1 - i) * 20, L[i]);
        end
    end
   
end

function RegisterPattern(period, pattern)
    local short, long, up, length, PatName;
    local price;
    short, long, up, length, PatName = DecodePattern(pattern);
    if length~=nil then
     local NumPat=FindNumberPattern(PatName);
     Outs[NumPat]:set(period, (AllPatterns + 1 - NumPat) * 20, "\110");
    end
end

local O, H, L, C, T, B, BL, US, LS; -- open, high, low, close prices, top and bottom of the candle, body, upper shadow and lower shadow length

function InitPattern(source)
    O = source.open;
    H = source.high;
    L = source.low;
    C = source.close;
    T = instance:addInternalStream(0, 0);
    B = instance:addInternalStream(0, 0);
    BL = instance:addInternalStream(0, 0);
    US = instance:addInternalStream(0, 0);
    LS = instance:addInternalStream(0, 0);
end

local PAT_NONE = 0;
local PAT_DOUBLE_INSIDE = 1;
local PAT_INSIDE = 2;
local PAT_OUTSIDE = 4;
local PAT_PINUP = 5;
local PAT_PINDOWN = 6;
local PAT_PPRUP = 7;
local PAT_PPRDN = 8;
local PAT_DBLHC = 9;
local PAT_DBHLC = 10;
local PAT_CPRU = 11;
local PAT_CPRD = 12;
local PAT_NB = 13;
local PAT_FBU = 14;
local PAT_FBD = 15;
local PAT_MB = 16;

local PAT_HAMMER=17;
local PAT_SHOOTSTAR=18;
local PAT_EVSTAR=19;
local PAT_MORNSTAR=20;
local PAT_BEARHARAMI=21;
local PAT_BEARHARAMICROSS=22;
local PAT_BULLHARAMI=23;
local PAT_BULLHARAMICROSS=24;
local PAT_DARKCLOUD=25;
local PAT_DOJISTAR=26;
local PAT_ENGBEARLINE=27;
local PAT_ENGBULLLINE=28;
local PAT_EVDJSTAR=29;
local PAT_MORNDJSTAR=30;
local PAT_NB2 = 31;


-- short name, name, up/down flag, length of pattern, pattern name
function DecodePattern(pattern)
    if pattern == PAT_NONE then
        return nil, nil, nil, nil, nil;
    elseif pattern == PAT_DOUBLE_INSIDE and instance.parameters:getBoolean("PAT_DOUBLE_INSIDE")==true then
        return "DblIn", "Double Inside", true, 3, "PAT_DOUBLE_INSIDE";
    elseif pattern == PAT_INSIDE and instance.parameters:getBoolean("PAT_INSIDE")==true then
        return "In", "Inside", true, 2, "PAT_INSIDE";
    elseif pattern == PAT_OUTSIDE and instance.parameters:getBoolean("PAT_OUTSIDE")==true then
        return "Out", "Outside", true, 2, "PAT_OUTSIDE";
    elseif pattern == PAT_PINUP and instance.parameters:getBoolean("PAT_PINUP")==true then
        return "PnUp", "Pin Up", true, 2, "PAT_PINUP";
    elseif pattern == PAT_PINDOWN and instance.parameters:getBoolean("PAT_PINDOWN")==true then
        return "PnDn", "Pin Down", false, 2, "PAT_PINDOWN";
    elseif pattern == PAT_PPRUP and instance.parameters:getBoolean("PAT_PPRUP")==true then
        return "PPRU", "Pivot Point Reversal Up", false, 3, "PAT_PPRUP";
    elseif pattern == PAT_PPRDN and instance.parameters:getBoolean("PAT_PPRDN")==true then
        return "PPRD", "Pivot Point Reversal Down", true, 3, "PAT_PPRDN";
    elseif pattern == PAT_DBLHC and instance.parameters:getBoolean("PAT_DBLHC")==true then
        return "DBLHC", "Double Bar Low With A Higher Close", false, 2, "PAT_DBLHC";
    elseif pattern == PAT_DBHLC and instance.parameters:getBoolean("PAT_DBHLC")==true then
        return "DBHLC", "Double Bar High With A Lower Close", true, 2, "PAT_DBHLC";
    elseif pattern == PAT_CPRU and instance.parameters:getBoolean("PAT_CPRU")==true then
        return "CPRU", "Close Price Reversal Up", false, 3, "PAT_CPRU";
    elseif pattern == PAT_CPRD and instance.parameters:getBoolean("PAT_CPRD")==true then
        return "CPRD", "Close Price Reversal Down", true, 3, "PAT_CPRD";
    elseif pattern == PAT_NB and instance.parameters:getBoolean("PAT_NB")==true then
        return "NB", "Neutral Bar", true, 1, "PAT_NB";
    elseif pattern == PAT_FBU and instance.parameters:getBoolean("PAT_FBU")==true then
        return "FBU", "Force Bar Up", false, 1, "PAT_FBU";
    elseif pattern == PAT_FBD and instance.parameters:getBoolean("PAT_FBD")==true then
        return "FBD", "Force Bar Down", true, 1, "PAT_FBD";
    elseif pattern == PAT_MB and instance.parameters:getBoolean("PAT_MB")==true then
        return "MB", "Mirror Bar", true, 2, "PAT_MB";
    elseif pattern == PAT_HAMMER and instance.parameters:getBoolean("PAT_HAMMER")==true then
        return "HAMMER", "Hammer Pattern", true, 1, "PAT_HAMMER";
    elseif pattern == PAT_SHOOTSTAR and instance.parameters:getBoolean("PAT_SHOOTSTAR")==true then
        return "SHOOTSTAR", "Shooting Star", true, 1, "PAT_SHOOTSTAR";
    elseif pattern == PAT_EVSTAR and instance.parameters:getBoolean("PAT_EVSTAR")==true then
        return "EVSTAR", "Evening Star", true, 3, "PAT_EVSTAR";
    elseif pattern == PAT_MORNSTAR and instance.parameters:getBoolean("PAT_MORNSTAR")==true then
        return "MORNSTAR", "Morning Star", true, 3, "PAT_MORNSTAR";
    elseif pattern == PAT_EVDJSTAR and instance.parameters:getBoolean("PAT_EVDJSTAR")==true then
        return "EVDJSTAR", "Evening Doji Star", true, 3, "PAT_EVDJSTAR";
    elseif pattern == PAT_MORNDJSTAR and instance.parameters:getBoolean("PAT_MORNDJSTAR")==true then
        return "MORNDJSTAR", "Morning Doji Star", true, 3, "PAT_MORNDJSTAR";
    elseif pattern == PAT_BEARHARAMI and instance.parameters:getBoolean("PAT_BEARHARAMI")==true then
        return "BEARHARAMI", "Bearish Harami", true, 2, "PAT_BEARHARAMI";
    elseif pattern == PAT_BEARHARAMICROSS and instance.parameters:getBoolean("PAT_BEARHARAMICROSS")==true then
        return "BEARHARAMICROSS", "Bearish Harami Cross", true, 2, "PAT_BEARHARAMICROSS";
    elseif pattern == PAT_BULLHARAMI and instance.parameters:getBoolean("PAT_BULLHARAMI")==true then
        return "BULLHARAMI", "Bullish Harami", true, 2, "PAT_BULLHARAMI";
    elseif pattern == PAT_BULLHARAMICROSS and instance.parameters:getBoolean("PAT_BULLHARAMICROSS")==true then
        return "BULLHARAMICROSS", "Bullish Harami Cross", true, 2, "PAT_BULLHARAMICROSS";
    elseif pattern == PAT_DARKCLOUD and instance.parameters:getBoolean("PAT_DARKCLOUD")==true then
        return "DARKCLOUD", "Dark Cloud Cover", true, 2, "PAT_DARKCLOUD";
    elseif pattern == PAT_DOJISTAR and instance.parameters:getBoolean("PAT_DOJISTAR")==true then
        return "DOJISTAR", "Doji Star", true, 2, "PAT_DOJISTAR";
    elseif pattern == PAT_ENGBEARLINE and instance.parameters:getBoolean("PAT_ENGBEARLINE")==true then
        return "ENGBEARLINE", "Engulfing Bearish Line", true, 2, "PAT_ENGBEARLINE";
    elseif pattern == PAT_ENGBULLLINE and instance.parameters:getBoolean("PAT_ENGBULLLINE")==true then
        return "ENGBULLLINE", "Engulfing Bullish Line", true, 2, "PAT_ENGBULLLINE";
    elseif pattern == PAT_NB2 and instance.parameters:getBoolean("PAT_NB2")==true then
        return "NB2", "2 Neutral Bars", true, 2, "PAT_NB2";
    else
        return nil, nil, nil, nil, nil;
    end
end

function Cmp(price1, price2)
    if math.abs(price1 - price2) < EQ then
        return 0;
    elseif price1 > price2 then
        return 1;
    else
        return -1;
    end
end

function UpdatePattern(p)
    T[p] = math.max(O[p], C[p]);
    B[p] = math.min(O[p], C[p]);
    BL[p] = T[p] - B[p];
    US[p] = H[p] - T[p];
    LS[p] = B[p] - L[p];

    if p >= 0 then
        -- 1 - candle patterns
        if Cmp(O[p], C[p]) == 0 and US[p] > math.max(EQ * 4, source:pipSize() * 4) and
                                    LS[p] > math.max(EQ * 4, source:pipSize() * 4) then
           RegisterPattern(p, PAT_NB);
        end

        if C[p] == H[p] then
           RegisterPattern(p, PAT_FBU);
        end

        if C[p] == L[p] then
           RegisterPattern(p, PAT_FBD);
        end
       
        if US[p] <= math.max(EQ, source:pipSize()) and LS[p]>2.*BL[p] then
           RegisterPattern(p, PAT_HAMMER);
        end

        if LS[p] <= math.max(EQ, source:pipSize()) and US[p]>2.*BL[p] then
           RegisterPattern(p, PAT_SHOOTSTAR);
        end
    end
    if p >= 1 then
        -- 2 - candle patterns
       if Cmp(H[p], H[p - 1]) < 0 and Cmp(L[p], L[p - 1]) > 0 then
           RegisterPattern(p, PAT_INSIDE);
       end
       if Cmp(H[p], H[p - 1]) > 0 and Cmp(L[p], L[p - 1]) < 0 then
           RegisterPattern(p, PAT_OUTSIDE);
       end
       if Cmp(H[p], H[p - 1]) == 0 and Cmp(C[p], C[p - 1]) < 0 and Cmp(L[p], L[p - 1]) <= 0 then
           RegisterPattern(p, PAT_DBHLC);
       end
       if Cmp(L[p], L[p - 1]) == 0 and Cmp(C[p], C[p - 1]) > 0 and Cmp(H[p], H[p - 1]) >= 0  then
           RegisterPattern(p, PAT_DBLHC);
       end
       if Cmp(BL[p - 1], BL[p]) == 0 and Cmp(O[p - 1], C[p]) == 0 then
           RegisterPattern(p, PAT_MB);
       end
       if Cmp(H[p],H[p-1])<0 and Cmp(L[p],L[p-1])>0 and Cmp(C[p-1],O[p-1])>0 and
       Cmp(C[p],O[p])<0 and Cmp(BL[p-1],BL[p])>0 and Cmp(C[p-1],O[p])>0 and Cmp(O[p-1],C[p])<0 then
           RegisterPattern(p, PAT_BEARHARAMI);
       end
       if Cmp(H[p],H[p-1])<0 and Cmp(L[p],L[p-1])>0 and Cmp(C[p-1],O[p-1])>0 and Cmp(O[p],C[p])==0 and
       Cmp(BL[p-1],BL[p])>0 and Cmp(C[p-1],O[p])>0 and Cmp(O[p-1],C[p])<0 then
           RegisterPattern(p, PAT_BEARHARAMICROSS);
       end
       if Cmp(H[p],H[p-1])<0 and Cmp(L[p],L[p-1])>0 and Cmp(C[p-1],O[p-1])<0 and
       Cmp(C[p],O[p])>0 and Cmp(BL[p-1],BL[p])>0 and Cmp(C[p-1],O[p])<0 and Cmp(O[p-1],C[p])>0 then
           RegisterPattern(p, PAT_BULLHARAMI);
       end
       if Cmp(H[p],H[p-1])<0 and Cmp(L[p],L[p-1])>0 and Cmp(C[p-1],O[p-1])<0 and Cmp(O[p],C[p])==0 and
       Cmp(BL[p-1],BL[p])>0 and Cmp(C[p-1],O[p])<0 and Cmp(O[p-1],C[p])>0 then
           RegisterPattern(p, PAT_BULLHARAMICROSS);
       end
       if Cmp(C[p-1],O[p-1])>0 and Cmp(C[p],O[p])<0 and Cmp(H[p-1],O[p])<0 and Cmp(C[p],C[p-1])<0 and Cmp(C[p],O[p-1])>0 then
           RegisterPattern(p, PAT_DARKCLOUD);
       end
       if Cmp(O[p],C[p])==0 and ((Cmp(C[p-1],O[p-1])>0 and Cmp(O[p],H[p-1])>0) or (Cmp(C[p-1],O[p-1])<0 and Cmp(O[p],L[p-1])<0)) then
           RegisterPattern(p, PAT_DOJISTAR);
       end
       if Cmp(C[p-1],O[p-1])>0 and Cmp(C[p],O[p])<0 and Cmp(O[p],C[p-1])>0 and Cmp(C[p],O[p-1])<0 then
           RegisterPattern(p, PAT_ENGBEARLINE);
       end
       if Cmp(C[p-1],O[p-1])<0 and Cmp(C[p],O[p])>0 and Cmp(O[p],C[p-1])<0 and Cmp(C[p],O[p-1])>0 then
           RegisterPattern(p, PAT_ENGBULLLINE);
       end
        if Cmp(O[p], C[p]) == 0 and US[p] > math.max(EQ * 4, source:pipSize() * 4) and
                                    LS[p] > math.max(EQ * 4, source:pipSize() * 4) and
      Cmp(O[p-1], C[p-1]) == 0 and US[p-1] > math.max(EQ * 4, source:pipSize() * 4) and
                                LS[p-1] > math.max(EQ * 4, source:pipSize() * 4) then
           RegisterPattern(p, PAT_NB2);
        end
    end

    if p >= 2 then
        -- 3 - candle patterns
        if Cmp(H[p], H[p - 1]) < 0 and Cmp(L[p], L[p - 1]) > 0 and
           Cmp(H[p - 1], H[p - 2]) < 0 and Cmp(L[p - 1], L[p - 2]) > 0 then
            RegisterPattern(p, PAT_DOUBLE_INSIDE);
        end
        if Cmp(H[p - 1], H[p - 2]) > 0 and Cmp(H[p - 1], H[p]) > 0 and
           Cmp(L[p - 1], L[p - 2]) > 0 and Cmp(L[p - 1], L[p]) > 0 and
           BL[p - 1] * 2 < US[p - 1] then
            RegisterPattern(p - 1, PAT_PINUP);
        end
        if Cmp(H[p - 1], H[p - 2]) < 0 and Cmp(H[p - 1], H[p]) < 0 and
           Cmp(L[p - 1], L[p - 2]) < 0 and Cmp(L[p - 1], L[p]) < 0 and
           BL[p - 1] * 2 < LS[p - 1] then
            RegisterPattern(p - 1, PAT_PINDOWN);
        end
        if Cmp(H[p - 1], H[p - 2]) > 0 and Cmp(H[p - 1], H[p]) > 0 and
           Cmp(L[p - 1], L[p - 2]) > 0 and Cmp(L[p - 1], L[p]) > 0 and
           Cmp(C[p], L[p - 1]) < 0 then
            RegisterPattern(p, PAT_PPRDN);
        end
        if Cmp(H[p - 1], H[p - 2]) < 0 and Cmp(H[p - 1], H[p]) < 0 and
           Cmp(L[p - 1], L[p - 2]) < 0 and Cmp(L[p - 1], L[p]) < 0 and
           Cmp(C[p], H[p - 1]) > 0 then
            RegisterPattern(p, PAT_PPRUP);
        end
        if Cmp(H[p - 1], H[p - 2]) < 0 and Cmp(L[p - 1], L[p - 2]) < 0 and
           Cmp(H[p], H[p - 1]) < 0 and Cmp(L[p], L[p - 1]) < 0 and
           Cmp(C[p], C[p - 1]) > 0 and Cmp(O[p], C[p]) < 0 then
            RegisterPattern(p, PAT_CPRU);
        end
        if Cmp(H[p - 1], H[p - 2]) > 0 and Cmp(L[p - 1], L[p - 2]) > 0 and
           Cmp(H[p], H[p - 1]) > 0 and Cmp(L[p], L[p - 1]) > 0 and
           Cmp(C[p], C[p - 1]) < 0 and Cmp(O[p], C[p]) > 0 then
            RegisterPattern(p, PAT_CPRD);
        end
        if Cmp(C[p-2],O[p-2])>0 and Cmp(C[p-1],O[p-1])>0 and Cmp(C[p],O[p])<0 and Cmp(C[p-2],O[p-1])<0 and
   Cmp(BL[p-2],BL[p-1])>0 and Cmp(BL[p-1],BL[p])<0 and Cmp(C[p],O[p-2])>0 and Cmp(C[p],C[p-2])<0 then
       RegisterPattern(p, PAT_EVSTAR);
   end
        if Cmp(C[p-2],O[p-2])<0 and Cmp(C[p-1],O[p-1])>0 and Cmp(C[p],O[p])>0 and Cmp(C[p-2],O[p-1])>0 and
   Cmp(BL[p-2],BL[p-1])>0 and Cmp(BL[p-1],BL[p])<0 and Cmp(C[p],C[p-2])>0 and Cmp(C[p],O[p-2])<0 then
       RegisterPattern(p, PAT_MORNSTAR);
   end
        if Cmp(C[p-2],O[p-2])>0 and Cmp(C[p-1],O[p-1])==0 and Cmp(C[p],O[p])<0 and Cmp(C[p-2],O[p-1])<0 and
   Cmp(BL[p-2],BL[p-1])>0 and Cmp(BL[p-1],BL[p])<0 and Cmp(C[p],O[p-2])>0 and Cmp(C[p],C[p-2])<0 then
       RegisterPattern(p, PAT_EVDJSTAR);
   end
        if Cmp(C[p-2],O[p-2])<0 and Cmp(C[p-1],O[p-1])==0 and Cmp(C[p],O[p])>0 and Cmp(C[p-2],O[p-1])>0 and
   Cmp(BL[p-2],BL[p-1])>0 and Cmp(BL[p-1],BL[p])<0 and Cmp(C[p],C[p-2])>0 and Cmp(C[p],O[p-2])<0 then
       RegisterPattern(p, PAT_MORNDJSTAR);
   end
    end
end
Attachments
Patterns4.lua
(19.89 KiB) Downloaded 1450 times
Alexander.Gettinger
FXCodeBase: Confirmed User
 
Posts: 2681
Joined: Wed Mar 31, 2010 9:40 pm
Location: Russia, Omsk

Re: 15 popular candle patterns

Postby DexTerity » Sun Dec 26, 2010 6:22 pm

This is the best candle pattern indicator by far.

Any chance that someone can convert it into MT4 format please?
DexTerity
 
Posts: 1
Joined: Sun Dec 26, 2010 6:16 pm

Re: 15 popular candle patterns

Postby Apprentice » Mon Dec 27, 2010 3:17 am

This forum is dedicated to Marketskope charting platform.
This requirement can be realized through our Premium Development Services
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 16525
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: 15 popular candle patterns

Postby eurekaaaa44 » Thu Jan 13, 2011 10:03 am

In Patterns4.lua, there is the following:

function Prepare()
EQ = instance.parameters.EQ * instance.source:pipSize();

What does "EQ" mean in "instance.parameters.EQ"?

It sounds like some sort of global parameter but I can't find it in the SDK guide.
eurekaaaa44
 
Posts: 2
Joined: Wed Jan 12, 2011 1:24 pm

Re: 15 popular candle patterns

Postby Apprentice » Thu Jan 13, 2011 2:45 pm

You're right.

In Init() function we define EQ Parameeter, user can change it.
indicator.parameters:addInteger("EQ", "Maximum of pips distance between equal prices", "", 1, 0, 100);

In Prepare() Function we call this parameter, its value we store in variable.
(In this case, multiply it with size of the Pip)

Description of Instance Parameters you can find in SDK guide here.
http://www.fxcodebase.com/documents/Ind ... eters.html
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 16525
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

PreviousNext

Return to Custom Indicators

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 5 guests