Experiments in Technical Analysis

Dear Karthik,
I have always been a reader of this thread..Trying to teach myself..It has been a wonderful experience to see you back in action..
I was wondering .. is it possible in amibroker to measure the slope of any EMA to filter strong trade possibilities on an intraday basis..As I found out that price/trend reversals are accompanied by a change in the slope of the MA..I generally use EMA cross to filter trades however in a sideways market there are whipsaws...
Awaiting your reply..
Regards
Anshuman
 
hello
below is the code of the above indicator

f=ATR(14);

rfsctor = WMA(H-L, Per);

revers = k * rfsctor;

Trend = 1;
NW[0] = 0;


for(i = 1; i < BarCount; i++)
{
if(Trend[i-1] == 1)
{
if(j < NW[i-1])
{
Trend = -1;
NW = j + Revers;
}
else
{
Trend = 1;
if((j - Revers) > NW[i-1])
{
NW = j - Revers;
}
else
{
NW = NW[i-1];
}
}
}
if(Trend[i-1] == -1)
{
if(j > NW[i-1])
{
Trend = 1;
NW = j - Revers;
}
else
{
Trend = -1;
if((j + Revers) < NW[i-1])
{
NW = j + Revers;
}
else
{
NW = NW[i-1];
}
}
}
}

//===============system================

Plot(NW, "", IIf(Trend == 1, 27, 4), 4);
Buy=Cover=Cross(j,nw);
Sell=Short=Cross(nw,j);
SellPrice=ValueWhen(Sell,C,1);
BuyPrice=ValueWhen(Buy,C,1);
Long=Flip(Buy,Sell);
Shrt=Flip(Sell,Buy );
_SECTION_END();
//=================TITLE================================================================================================
_SECTION_BEGIN("Title");
if( Status("action") == actionIndicator )
(
Title = EncodeColor(colorWhite)+ "NICK MA Swing System" + " - " + Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +
" - " + Date() +" - "+"\n" +EncodeColor(colorYellow) +"Op-"+O+" "+"Hi-"+H+" "+"Lo-"+L+" "+
"Cl-"+C+" "+ "Vol= "+ WriteVal(V)+"\n"+
EncodeColor(colorLime)+
WriteIf (Buy , " GO LONG / Reverse Signal at "+C+" ","")+
WriteIf (Sell , " EXIT LONG / Reverse Signal at "+C+" ","")+"\n"+EncodeColor(colorWhite)+
WriteIf(Sell , "Total Profit/Loss for the Last Trade Rs."+(C-BuyPrice)+"","")+
WriteIf(Buy , "Total Profit/Loss for the Last trade Rs."+(SellPrice-C)+"","")+
WriteIf(Long AND NOT Buy, "Trade : Long - Entry price Rs."+(BuyPrice),"")+
WriteIf(shrt AND NOT Sell, "Trade : Short - Entry price Rs."+(SellPrice),"")+"\n"+
WriteIf(Long AND NOT Buy, "Current Profit/Loss Rs."+(C-BuyPrice)+"","")+
WriteIf(shrt AND NOT Sell, "Current Profit/Loss Rs."+(SellPrice-C)+"",""));
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);


now if this can be modified into metastock

rotoline





dear karthikmarar and asishda,
please put this code into metastock language.
 
Last edited:

casoni

Well-Known Member
Dear Karthik,
I have always been a reader of this thread..Trying to teach myself..It has been a wonderful experience to see you back in action..
I was wondering .. is it possible in amibroker to measure the slope of any EMA to filter strong trade possibilities on an intraday basis..As I found out that price/trend reversals are accompanied by a change in the slope of the MA..I generally use EMA cross to filter trades however in a sideways market there are whipsaws...
Awaiting your reply..
Regards
Anshuman
HELLO anshuman,
do try this....green ema is uptrend, red is down trend , black is flat...
Ema34 = EMA(Close,34);
//Calculating price range for last 30 bars
LowLow30 = LLV(L, 30);
Range = 25 / (HHV(H, 30) - LowLow30) * LowLow30;
//Ema34 angle
Ema34_y2 = (Ref(Ema34, -2) - Ema34) / Avg * Range / 2; //avg diff of 2 bars !
Ema34_c = sqrt(1 + Ema34_y2 * Ema34_y2);
Ema34Angle = round(180 * acos(1/Ema34_c) / 3.1415);
Ema34Angle = IIf(Ema34_y2 > 0, - Ema34Angle, Ema34Angle);
Czi = IIf(Ema34Angle >= 5, 1, IIf(Ema34Angle <=-5, -1, 0));
CziUp = IIf(Czi > 0, 1, 0);
CziDown = IIf(Czi < 0, -1, 0);
COL=IIf(CZIUP,colorGreen,IIf(CZIDOWN,colorRed,colorblack));
Plot(EMA34,"EMA",COL,1);
Title = "{{NAME}} - {{INTERVAL}} {{DATE}} {{VALUES}}:" +"\n"
+"Op-"+O+" "+"Hi-"+H+" "+"Lo-"+L+" "+
"Cl-"+C+" "+ "Vol= "+ WriteVal(V)
+("\nEMA=")+WriteIf( Czi == 1, "UPTREND", WriteIf( Czi == -1, "DOWNTREND", "FLAT" ));
hope its useful.
thank you
 
Thanks Casoni..Will Try it out..I am looking for an exploration which will
give an indication as soon as the EMA slope changes from downward/flat to upwards and vice versa..
I will try to tweak you code to fit my requirements..if unsucsessful might disturb you further:D..

Regards
Anshuman

P.S.-Thanks once again
 
Not trying to prove anything... Just wondering if anyone compared the NMA with the Flow Method...

Hi Karthik,

Not trying to say anything.......But the ADD positions in the first move in the 60min Flow is wrong,much earlier adds......there is no Sell Short in that consolidation,and therefore no Cover to Buy after that.

Reversal to Short after that is too late,reversal is higher than that.....after that,a few adds,not so late as is shown in your charts....the following cover and long is correct,once again many adds not mentioned in your chart.....the last Sell Short is a Pivot too late,earlier reversal actually....once again,many adds before that last add on your chart.

But very nice system,that nma system.......trade it and make great profits,my friend.Hope the traders trading the Flow do likewise.

Saint
 
oops .. posted a 5 min chart by mistake

here is a a 60 min chart..

Oops,okay......let us have a look at this one......

That first Cover and long is not there.....still short through that mini pullback.Continuation short after that is a hold and more adds ....the next cover and long also not there,still short.The next sell short is not there as we are still short.No cover again after that......Yikes we are holding shorts all the way till the end.

And that last cover and buy lower,happens the previous day as compared to the chart.

Once again,nice system though......:clapping:

Saint
 

karthikmarar

Well-Known Member
Ah.. My Friend Saint.

My post has served the purpose .....by pulling you out of your indefinite break :clap:

The Flow system can be done perfectly only by eyeballing the chart. No afl or coding can match that. The afl can serve the purpose of some guidance only if at all.

In coding we can different methods for calculating the pivots. the chart enclosed uses zig zag. We can also use a five finger method or even a three finger method. Each gives varying results. Also the Gap rule cannot be applied here... at least in AB. Also the add positions were delayed by a bar as i saw many adds happened towards the end of a move. Just experimenting :)

Again as I said before was not trying to prove anything. Just curiosity... as per my initial studies thought it could be a comparable system. :D

Nice to see you posting .. :thanx:

regards

Karthik
 

Similar threads