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

Luxor for Amibroker (AFL)

Rating:
3 / 5 (Votes 4)
Tags:
trading system, amibroker

The book “Trading System” talking about building a luxor system for currency trading.
http://www.amazon.com/Trading-Systems-Development-Portfolio-Optimisation/dp/1905641796

Trading Systems: A New Approach to System Development and Portfolio Optimisation

Page 44 has Luxor in TradeStation Easy Language.
I have converted it to AFL

Screenshots

Similar Indicators / Formulas

All in One
Submitted by Nahid over 13 years ago
Kase Peak Osc. V2 batu
Submitted by batu1453 almost 10 years ago
Kase CD V2batu
Submitted by batu1453 almost 10 years ago
Ichimoku
Submitted by prashantrdx almost 10 years ago
Arvind' System
Submitted by akdabc almost 14 years ago
Miftha remix for dse
Submitted by coolpace over 13 years ago

Indicator / Formula

Copy & Paste Friendly
SmaPeriodFast = 10;
SmaPeriodSlow = 30;
StartTime = 1 ; // 10000 * Hour + 100 * Minute + Second, so 12:37:15 becomes 123715
EndTime = 22;

tn = TimeNum();
timeCheck = tn >=( StartTime * 10000) AND tn <=  ( EndTime * 10000);


FastMA = MA(Close, SmaPeriodFast );
SlowMA = MA(Close, SmaPeriodSlow );

IsLong = FastMA > SlowMA;
IsShort = SlowMA > FastMA;
LongSignal  = Cross(FastMA, SlowMA);
ShortSignal = Cross(SlowMA, FastMA);


LongConfirmPrice = ValueWhen(LongSignal, H) + 0.001;
ShortConfirmPrice = ValueWhen(ShortSignal, L) - 0.001;

Buy = IsLong  AND H > LongConfirmPrice AND timeCheck ;
Sell = (IsShort AND L < ShortConfirmPrice) OR Cross( tn, EndTime);

Short = (IsShort AND L < ShortConfirmPrice) AND timeCheck ;
Cover = ( IsLong  AND H > LongConfirmPrice) OR Cross( tn, EndTime);

Buy =ExRem(Buy,Sell);
Sell =ExRem(Sell,Buy);
Short=ExRem(Short,Cover);
Cover= ExRem(Cover,Short);

Plot(C,"Close", colorBlack, styleCandle);
Plot(FastMA,"Fast MA", colorRed, styleThick);
Plot(SlowMA,"Slow MA", colorBlue, styleThick );

PlotShapes( IIf( LongSignal  , shapeSmallCircle + shapePositionAbove, shapeNone ), colorGreen );
PlotShapes( IIf( ShortSignal , shapeSmallCircle , shapeNone ), colorRed );

PlotShapes( IIf( Buy  , shapeUpArrow, shapeNone ), colorGreen );
PlotShapes( IIf( Sell , shapeDownArrow, shapeNone ), colorRed );

7 comments

1. nareshpriya

thx

2. XavierJohn

The end of day close code is incorrect.

How do I update the submitted code?

It should be

Buy = IsLong  AND H > LongConfirmPrice AND timeCheck ;
Sell = (IsShort AND L < ShortConfirmPrice) OR Cross( tn, EndTime);

Short = (IsShort AND L < ShortConfirmPrice) AND timeCheck ;
Cover = ( IsLong  AND H > LongConfirmPrice) OR Cross( tn, EndTime);

Buy =ExRem(Buy,Sell);
Sell =ExRem(Sell,Buy);
Short=ExRem(Short,Cover);
Cover= ExRem(Cover,Short);
3. administrator

Updated it for you.

4. johnnypareek

Hi,

The time part is out of my mind. can ne one make for 9.15 to 03.30 pm ????

5. XavierJohn

It is used to trade EUR currency.

6. thangnd.1211

great trading system for amibroker, thank bro !

7. JoeHart

Thank you for sharing this really nice system and the code! I already got the book also and learned a lot on trading systems already from it.

About the code- I applied it to some FOREX markets.

I think your above formula contains a mistake with the time filter. The system does not enter within the selected time window, but instead always at the beginning of the time window. Unfortunately my programming skills are too limited to correct this.

It should be programmed like this:

While the time filter condition is true: Check if the fast moving average crosses the slow one etc. Once the time filter condition is no longer true, no entries are possible. At the moment, the entry is always at the very first bar of the time window, e.g. every day at 9:35 (if the time window is 9:30 -12:00 and you work with 5 minute bars). Like this the time filter is useless.

And according to the book “Trading Systems” where the code is from, the time filter is the haert, the main point of the logic! This is a pity…

Maybe anyone can help?

Leave Comment

Please login here to leave a comment.

Back