Stock Portfolio Organizer

The ultimate porfolio management solution.

Shares, Margin, CFD's, Futures and Forex
EOD and Realtime
Dividends and Trust Distributions
And Much More ....
Find Out More Here

WiseTrader Toolbox

#1 Selling Amibroker Plugin featuring:

Advanced Adaptive Indicators
Advanced Pattern Exploration
Neural Networks
And Much More ....
Find Out More Here

Mother Candle Formation Strategy for Amibroker (AFL)

Rating:
5 / 5 (Votes 1)
Tags:
amibroker, pattern, candlestick, trading system

Here is another Trade Plan using simple candlestick analysis.

The idea on this strategy is to catch a break from a sudden move of a big candle move. It can be done on any time series of chart, but recommended on the 10 to 60 minute charts. Only one trade Per symbol per day, recommended to trade in minimum 7 symbols (mini lots). Optimization can be done only on profit and target for Entry we are using a plugin named “MotherCandle”. Plugin should be placed into amibroker (c/programfiles/amibroker/plugins) folder.This AFL will work only if microsoft visual c++ 2017 redistributable package (x86). You Can download from microsoft website https://go.microsoft.com/fwlink/?LinkId=746571.

Please Use Amibroker 6.0 above version For error Free trading Experience

Files

Indicator / Formula

Copy & Paste Friendly
_SECTION_BEGIN( "Mother Candle Formation Strategy" );

/*

Here is another Trade Plan using simple candlestick analysis.
The idea on this strategy is to catch a break from a sudden move of a big candle move.
It can be done on any time series of chart, but recommended on the 10 or 60 minute charts.
Only one trade Per symbol per day,recommended to trade in minimum 7 symbols (mini lots).
Optimization can be done only on profit and target for Entry we are using a plugin named "MotherCandle".
Plugin should be placed into amibroker (c/programfiles/amibroker/plugins) folder.
This AFL will work only if microsoft visual c++ 2017 redistributable package (x86).
You Can dowload from microsoft website https://go.microsoft.com/fwlink/?LinkId=746571.

Created By Viatrades Algo Team.
viatradess@gmail.com
*/

SetPositionSize( 1, spsShares );
SetBarsRequired( sbrAll, sbrAll );

SetChartOptions( 0, chartShowArrows | chartShowDates );
SetChartBkGradientFill( colorBlack, colorBlack, colorBlack );
Plot( C, "", IIf( C > O, colorBlueGrey, IIf( C <= O, colorOrange, colorLightGrey ) ), 64 | styleNoTitle, 0, 0, 0, 0 );


GraphXSpace = 10;

DN = DateNum();
TN = TimeNum();

function Asign( x )
{
    y = Null;

    for( i = 0; i < BarCount; i++ )
    {
        y[i] = x;
    }

    return y;
}

Target = Param( "Target %", 1, 0.1, 50, 0.01 ) / 100;
StopLoss = Param( "Stop Loss %", 0.75, 0.1, 50, 0.01 ) / 100;
DaysTrades = Param( "Trades / Day", 2, 0, 50, 1 );


DayStart = DN != Ref( DN, -1 );
DayEnd = Ref( DayStart, 1 );
////If below line ( MotherCandle();) is in Black color please install microsoft visual c++ 2017 redistributable package (x86).
//you Can dowload from microsoft website" https://go.microsoft.com/fwlink/?LinkId=746571 ".
MotherCandle();

Buy = Asign( False );
Sell = Asign( False );
Short = Asign( False );
Cover = Asign( False );

BuyPrice = Null;
ShortPrice = Null;

BYPRSV = Null;
SHPRSV = Null;

LF1 = False;
LF2 = False;
SF1 = False;
SF2 = False;

LSL = Null;
SSL = Null;

LTGT = Null;
STGT = Null;

count = 0;

for( i = 1; i < BarCount; i++ )
{
    if( DayStart[i] == True )
    {
        count = 0;
    }

	// Long Trade
    if( BuyTrig[i] != 0 && High[i] >= BuyTrig[i] && LF1 == False && LF2 == False && DayStart[i] == False && count < DaysTrades )
    {
        Buy[i] = True;
        LF1 = True;
        BYPRSV = BuyTrig[i];

        if( Open[i] > BYPRSV )
        {
            BYPRSV = Open[i];
        }

        LF2 = True;
        count++;
    }

    if( LF1 == False && Close[i - 1] < BuyTrig[i] )
    {
        LF2 = False;
    }

    if( LF1 == True )
    {
        BuyPrice[i] = BYPRSV;
        LSL[i] = BYPRSV - ( BYPRSV * StopLoss );
        LTGT[i] = BYPRSV + ( BYPRSV * Target );
    }

    if( LF1 == True && High[i] > LTGT[i] )
    {
        Sell[i] = True;
        SellPrice[i] = Close[i];
        LF1 = False;
        BuyPrice[i] = Null;
        LSL[i] = Null;
        LTGT[i] = Null;
    }

    if( LF1 == True && Low[i] < LSL[i] )
    {
        Sell[i] = True;
        SellPrice[i] = Close[i];
        LF1 = False;
        BuyPrice[i] = Null;
        LSL[i] = Null;
        LTGT[i] = Null;
    }

    if( LF1 == True && DayEnd[i] == True )
    {
        Sell[i] = True;
        SellPrice[i] = Close[i];
        LF1 = False;
        BuyPrice[i] = Null;
        LSL[i] = Null;
        LTGT[i] = Null;
    }

	// Short Trade
    if( ShortTrig[i] != 0 && Low[i] < ShortTrig[i] && SF1 == False && SF2 == False && DayStart[i] == False && count < DaysTrades )
    {
        Short[i] = True;
        SF1 = True;
        SHPRSV = ShortTrig[i];

        if( Open[i] < SHPRSV )
        {
            SHPRSV = Open[i];
        }

        SF2 = True;
        count++;
    }

    if( SF1 == False && Close[i - 1] > ShortTrig[i] )
    {
        SF2 = False;
    }

    if( SF1 == True )
    {
        ShortPrice[i] = SHPRSV;
        SSL[i] = SHPRSV + ( SHPRSV * StopLoss );
        STGT[i] = SHPRSV - ( SHPRSV * Target );
    }

    if( SF1 == True && Low[i] < STGT[i] )
    {
        Cover[i] = True;
        CoverPrice[i] = Close[i];
        SF1 = False;
        ShortPrice[i] = Null;
        SSL[i] = Null;
        STGT[i] = Null;
    }

    if( SF1 == True && High[i] > SSL[i] )
    {
        Cover[i] = True;
        CoverPrice[i] = Close[i];
        SF1 = False;
        ShortPrice[i] = Null;
        SSL[i] = Null;
        STGT[i] = Null;
    }

    if( SF1 == True && DayEnd[i] == True )
    {
        Cover[i] = True;
        CoverPrice[i] = Open[i];
        SF1 = False;
        ShortPrice[i] = Null;
        SSL[i] = Null;
        STGT[i] = Null;
    }
}


Plot( BuyPrice, "Buy Price", colorYellow, styleStaircase | styleDashed );
Plot( LTGT, "Long Target", colorBrightGreen, styleStaircase | styleDashed );
Plot( LSL, "Long Stop Loss", colorCustom12, styleStaircase | styleDashed );


Plot( ShortPrice, "Short Price", colorYellow, styleStaircase | styleDashed );
Plot( STGT, "Short Target", colorBrightGreen, styleStaircase | styleDashed );
Plot( SSL, "Short StopLoss", colorCustom12, styleStaircase | styleDashed );


PlotShapes( IIf( Buy, shapeUpArrow, shapeNone ), colorBlueGrey, 0, Low, -15, 0 );
PlotShapes( IIf( Short, shapeDownArrow, shapeNone ), colorOrange, 0, High, -15, 0 );
PlotShapes( IIf( Cover, shapeCircle, shapeNone ), colorBlueGrey, 0, Low, -35, 0 );
PlotShapes( IIf( Sell, shapeCircle, shapeNone ), colorOrange, 0, High, 35, 0 );

_SECTION_END();

3 comments

1. MANIIS123

Thanks for sharing. So may errors. please correct

2. joby Kumar

Hi MANIIS123,
Use amibroker version above 6.0 for better results and please follow the below steps
1) Download the Plugin attached
2) Plugin should be placed into amibroker (c/programfiles/amibroker/plugins) folder.
3)This AFL will work only if microsoft visual c++ 2017 redistributable package (x86) is Installed.
You Can dowload from microsoft website https://go.microsoft.com/fwlink/?LinkId=746571.

3. isc0rpi0

couple you please post screenshot of the indicator

Leave Comment

Please login here to leave a comment.

Back