31.07.2021 Views

Ultimate Algorithmic Trading System

Using automated systems for trading in stock markets

Using automated systems for trading in stock markets

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

1. movAvgLen { 50 to 150 by 10 increments } [11 iterations]

2. pivotHiLookBack {3 to 5 by 1 increment} [3 iterations]

3. pivotHiStrength {1 to 3 by 1 increment} [3 iterations]

4. pivotLowLookBack {3 to 5 by 1 increment} [3 iterations]

5. pivotLowStrength {1 to 3 by 1 increment} [3 iterations]

6. LprofitObjective {500 to 1500 by 50 increment} [21 iterations]

7. LstopLoss {250 to 750 by 50 increment} [11 iterations]

8. SprofitObjective {500 to 1500 by 50 increment} [21 iterations]

9. SstopLoss {250 to 750 by 50 increment} [11 iterations]

10. longExitDays {5to15by1} [11 iterations]

11. shortExitDays {5to15by1} [11 iterations]

The total search space = 11 ∗ 3 ∗ 3 ∗ 3 ∗ 3 ∗ 21 ∗ 11 ∗ 21 ∗ 11 ∗ 11 ∗ 11

= 5,752,902,771

That is nearly 6 billion iterations. Fortunately, the genetic method of optimization

is available.

Here is the code for entries and exits:

Value1 = SwingHiBar(1,H,pivotHiStrength,pivotHiLookBack);

Value2 = SwingLowBar(1,L,pivotLowStrength,pivotLowLookBack);

If C > Average(C,avgLen) then

Begin

If Value1 <> -1 then Buy this Bar on Close;

End;

If C < Average(C,avgLen) then

Begin

If Value2 <> -1 then SellShort this Bar on Close;

End;

If MarketPosition = 1 Then

Begin

Sell Next Bar at EntryPrice + LprofitObjective/bigPointValue limit;

Sell Next Bar at EntryPrice - longStopLoss/bigPointValue stop;

End;

255

GENETIC OPTIMIZATION, WALK FORWARD

If MarketPosition = -1 Then

Begin

BuyToCover Next Bar at EntryPrice - SprofitObjective/

bigPointValue limit;

BuyToCover Next Bar at EntryPrice + shortStopLoss/

bigPointValue stop;

End;

www.rasabourse.com

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!