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 ....
For Portfolio Manager Click Here

WiseTrader Toolbox

#1 Selling Amibroker Plugin featuring:

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

Volume Based Intraday Trading Strategy for Amibroker (AFL)

Rating:
5 / 5 (Votes 1)
Tags:
amibroker, trading system, volume, intraday

Volume based intraday trading strategy, suitable for algo traders. Buy and Sell conditions are based on previous day Volume. Trigger price, start Time, end time, stop loss and target has been added.

Screenshots

Indicator / Formula

Copy & Paste Friendly
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
///Volume Based Intraday AFl for algo traders
///Created by Team Viatrades
///viatradess@gmail.com
SetPositionSize(1, spsShares);
SetBarsRequired(sbrAll, sbrAll);
 
SetChartOptions(0,chartShowArrows|chartShowDates);
SetChartBkGradientFill(colorBlack,colorBlack,colorBlack);
SetBarFillColor(IIf(C>O,colorPaleBlue,IIf(C<=O,colorOrange,colorLightGrey)));
Plot(C,"\nPrice",IIf(C>O,colorPaleBlue,IIf(C<=O,colorOrange,colorLightGrey)),64|styleNoTitle,0,0,0,0);
GraphXSpace = 10;
 
// Time Given for MCX You can Change this
StartTime = ParamTime("Start Time", "10:00:00");
StopTime = ParamTime("End Time", "23:00:00");
 
Target = Param("Target %", 1, 0.1, 50, 0.01)/100;
StopLoss = Param("Stop Loss %", 0.6, 0.1, 50, 0.01)/100;
 
 
DCAL = DateNum();
HCAL = 0;
HCALPrice = 0;
LCALPrice = 0;
CurDNPrice = 0;
FirDNDNPrice = DCAL[0];
TN = TimeNum();
DT = DateTime();
LDT = DT[BarCount-1];
 
VOLPRICECAL = Null;
VOLLOWPRICECAL = Null;
 
HIGPRCCALC = Null;
LOWPRCCALC = Null;
 
PrevDay = 0;
 
for(i = 1; i < BarCount; i++)
{
    if(CurDNPrice != DCAL[i] && FirDNDNPrice != DCAL[i])
    {
        VOLPRICECAL = HCALPrice;
        VOLLOWPRICECAL = LCALPrice;
         
        CurDNPrice = DCAL[i];
        HCAL = 0;
        HCALPrice = 0;
        LCALPrice = 0;
        HIGPRCCALC[i-1] = Null;
        LOWPRCCALC[i-1] = Null;
    }
     
    HIGPRCCALC[i] = VOLPRICECAL;
    LOWPRCCALC[i] = VOLLOWPRICECAL;
     
    if(HCAL < Volume[i])
    {
        HCAL = Volume[i];
        HCALPrice = High[i];
        LCALPrice = Low[i];
    }
}
 
 
Plot(HIGPRCCALC, "Prev High", colorGrey50, styleStaircase|styleDashed);
Plot(LOWPRCCALC, "Prev Low", colorGrey50, styleStaircase|styleDashed);
 
Buy = Ref(Close > HIGPRCCALC, -1) AND TN > StartTime AND TN < StopTime AND TN > Ref(TN, -1);
Short = Ref(Close < LOWPRCCALC, -1) AND TN > StartTime AND TN < StopTime  AND TN > Ref(TN, -1);
 
Sell = Ref(Close < LOWPRCCALC, -1) OR TN >= StopTime;
Cover = Ref(Close > HIGPRCCALC, -1) OR TN >= StopTime;
 
Buy = ExRem(Buy, Sell);
Sell = ExRem(Sell, Buy);
 
Short = ExRem(Short, Cover);
Cover = ExRem(Cover, Short);
 
BuyPrice = ValueWhen(Buy, Open);
ShortPrice = ValueWhen(Short, Open);
 
SellPrice = ValueWhen(Sell, Open);
CoverPrice = ValueWhen(Cover, Open);
 
LongTargetPrice = BuyPrice + (BuyPrice * Target);
ShortTargetPrice = ShortPrice - (ShortPrice * Target);
 
LongSLPrice = BuyPrice - (BuyPrice * Target);
ShortSLPrice = ShortPrice + (ShortPrice * Target);
 
Sell1 = High > LongTargetPrice;
Sell2 = Low < LongSLPrice;
 
Cover1 = Low < ShortTargetPrice;
Cover2 = High > ShortSLPrice;
 
Sell = Sell OR Sell1 OR Sell2;
Cover = Cover OR Cover1 OR Cover2;
 
SellPrice = IIf(Sell1, LongTargetPrice, IIf(Sell2, LongSLPrice, SellPrice));
CoverPrice = IIf(Cover1, ShortTargetPrice, IIf(Cover2, ShortSLPrice, CoverPrice));
 
Buy = ExRem(Buy, Sell);
Sell = ExRem(Sell, Buy);
 
Short = ExRem(Short, Cover);
Cover = ExRem(Cover, Short);
 
BuyPlotsCandles = (BarsSince(Buy)<BarsSince(Sell)) AND (BarsSince(Buy)!=0);
ShortPlotCandles = (BarsSince(Cover)>BarsSince(Short)) AND (BarsSince(Short)!=0);
 
Plot(IIf(BuyPlotsCandles, BuyPrice, Null), "Buy Price", colorYellow, styleStaircase|styleDashed);
Plot(IIf(BuyPlotsCandles, LongTargetPrice, Null), "Long Target", colorBrightGreen, styleStaircase|styleDashed);
Plot(IIf(BuyPlotsCandles, LongSLPrice, Null), "Long Target", colorCustom12, styleStaircase|styleDashed);
 
Plot(IIf(ShortPlotCandles, ShortPrice, Null), "Short Price", colorYellow, styleStaircase|styleDashed);
Plot(IIf(ShortPlotCandles, ShortTargetPrice, Null), "Short Target", colorBrightGreen, styleStaircase|styleDashed);
Plot(IIf(ShortPlotCandles, ShortSLPrice, Null), "Short Target", colorCustom12, styleStaircase|styleDashed);
 
Buyshape = Buy * shapeUpArrow;
SellShape = Sell * shapeStar;
PlotShapes( Buyshape, colorBrightGreen, 0, Low );
PlotShapes( SellShape, colorRed, 0, High );
 
Shortshape = Short * shapeDownArrow;
CoverShape = Cover * shapeStar;
PlotShapes( Shortshape, colorOrange, 0, High, -30);
PlotShapes( CoverShape, colorTurquoise, 0, Low, -30 );

3 comments

1. tradermind

Administrator, please correct: Sell = Ref(Close < LOWPRCCALC, 1) OR TN >= StopTime; is wrong this is looking forward , this is correct: ell = Ref(Close < LOWPRCCALC, -1) OR TN >= StopTime; i hope is not intentionally.. thanks

2. administrator

Thanks for pointing it out. I don’t think it was intentionally that way I have corrected it.

3. sagar2kd

very good afl

Leave Comment

Please login here to leave a comment.

Back