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

RANDOM ENTRY for Amibroker (AFL)
almost 6 years ago
Amibroker (AFL)

4 / 5 (Votes 2)
trading system, amibroker

Using a random entry, it is possible to isolate the effects of the exit from the entry.

Indicator / Formula

Copy & Paste Friendly
_SECTION_BEGIN("Formula 1");
// Entry a position at the close of a random bar.
// A random entry for use as a benchmark.
// Expect this entry to mirror the buy and hold.
// It cannot be profitable taking long positions in 
//	a declining market, or	taking	short	positions
//	in a rising market.
//	This code just waits a	fixed number	of	bars to exit.
//	It can be used to test	any of	the exit	systems.
// For market orders, enter and exit Market On Close
// with no delay
BuyPrice = C;
SellPrice = C;
// Frequency is the number of entries per year.
Frequency = Param("Entries per Year",12,1,100,1);
// Repeatable is a switch.
// True (1): the sequence of random numbers will be repeated.
// False (0): each sequence is random.
Repeatable = Param("Repeatable",0,0,1,1);
// Seed is the number used to start the random sequence // when repeatable sequences are desired.
Seed = Param("Seed", 13331,1,99999,1);
// Generate a fraction, uniformly distributed // between 0.00000 AND 0.99999.
NextRandom = IIf (Repeatable,Random(Seed),Random());
Buy = IIf (NextRandom<Frequency/252,1,0);
// The code for the exit being tested starts here.
// HoldBars is the number of bars to wait for exit.
HoldBars = Param("HoldBars", 3,1,100,1);
Sell = BarsSince(Buy)>=HoldBars;
// The code for the exit being tested ends here.
// Remove extra Buy and Sell signals.
Buy = ExRem(Buy, Sell);
Sell = ExRem(Sell,Buy);


Leave Comment

Please login here to leave a comment.