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

4-Day-Range Switch for Amibroker (AFL)
santho_sd
almost 14 years ago
Amibroker (AFL)

Rating:
3 / 5 (Votes 6)
Tags:
amibroker, exploration

4-Day-Range Switch

Similar Indicators / Formulas

GapUp and Bearish Close (Reversal) _Daily
Submitted by indraji2001 almost 10 years ago
General Market Exploration by XeL
Submitted by xel almost 12 years ago
DIX50,20,10
Submitted by morgen almost 14 years ago
Deel - Average Dollar Price Volatility
Submitted by kaiji over 14 years ago
Volume Spike Exploration
Submitted by ngocleasing almost 14 years ago
All in one Explorer
Submitted by Mithun almost 14 years ago

Indicator / Formula

Copy & Paste Friendly
//4-Day-Range Switch
prev=AMA2(C,1,0);
d=IIf(C>Ref(Max(Max(H,Ref(H,-3)),Max(Ref(H,-1),Ref(H,-2))),-1),Min(Min(L,Ref(L,-3)),Min(Ref(L,-1),Ref(L,-2))),
  IIf(C<Ref(Min(Min(L,Ref(L,-3)),Min(Ref(L,-1),Ref(L,-2))),-1),Max(Max(H,Ref(H,-3)),Max(Ref(H,-1),Ref(H,-2))),PREV));
a=Cross(Close,d);
b=Cross(d,Close);
state=IIf(BarsSince(a)<BarsSince(b),1,0);
s=state>Ref(state,-1);
ss=state<Ref(state,-1);
sss=state==Ref(state,-1);
col=IIf(state == 1 ,51,IIf(state ==0,4,1));
Plot(C,"",Col,128);
PlotShapes( shapeUpArrow * s ,6,0,L); 
PlotShapes( shapeDownArrow *ss ,4,0,H);

Filter =  s OR sss OR sss  ;
AddColumn(C,"close",1.2);
AddColumn( IIf( s, 66,1 ), "buy", formatChar, 1, bkcolor =IIf (s,colorGreen, colorRed ));
AddColumn( IIf( Ss, 83,1 ), "sell", formatChar, 1, bkcolor =IIf (Ss,colorRed, colorGreen ));
AddColumn( IIf( sss, 87,1 ), "wait", formatChar, 1, bkcolor =IIf (sss,colorYellow, colorRed ));
                            
//_SECTION_BEGIN("");
//_N(Title = "{{NAME}} - {{INTERVAL}} {{DATE}}: "+_DEFAULT_NAME()+" : {{OHLCX}} {{VALUES}}" 
//+"\n"+EncodeColor(colorYellow)+
//WriteIf(s,"EXIT all Short positions\nif trading long positions, enter long Now-\nOR at the market price on tomorrow's Open with stop="+EncodeColor(4)+WriteVal(L+.75*ATR(5),1.4)+",","")+
//WriteIf(ss,"exit all long positions today with a Market On Close (MOC) order\nOR at the market price on tomorrow's Open with stop="+EncodeColor(4)+WriteVal(Ref(H+.75*ATR(5), -1),1.4)+",","")+ 
//WriteIf( sss ,"No trading signals today.","") );

AlertIf( s, "SOUND D:\songs\bhi.mp3", "Audio alert", 2 );
AlertIf( ss, "SOUND C:\\Windows\\Media\\Ding.wav", "Audio alert", 5 );

3 comments

1. gopal

Seems to be a effective system for day trading.

2. cnbondre

Dear,

Good system for Intraday as well as for swing/short term trade.
Thanks for sharing with us.
cnbondre

3. vijayss

Hi,

Could someone modify the code so that a backtest be run.

I think the last section is not working (although I am no expert in coding)

//SECTION_BEGIN("");
//N(Title = "{{NAME}} – {{INTERVAL}} {{DATE}}: "+DEFAULT
NAME+
//WriteIf(s,“EXIT all Short positions\nif trading long positions, enter long Now-\nOR at the market price on tomorrow’s Open with stop=”EncodeColor(4)WriteVal(L+.75*ATR(5),1.4)“,”,"")
//WriteIf(ss,“exit all long positions today with a Market On Close (MOC) order\nOR at the market price on tomorrow’s Open with stop=”EncodeColor(4)WriteVal(Ref(H+.75*ATR(5), -1),1.4)“,”,"")
//WriteIf( sss ,“No trading signals today.”,"") );

Leave Comment

Please login here to leave a comment.

Back