Back

Simple scalping with Williams Fractals

Here's a very simple scalping strategy using the Fractals Indicator by Bill Williams. The Buy fractal is formed by a sequence of at least 5 bars where the lowest low is in the middle. The Sell fractal is formed by a sequence of at least 5 bars where the highest high is in the middle. Williams Fractals take advantage of the fact that many markets spend a majority of their time in ranges.

Update Backtest








Is this after slippage and commission? 

1

This also assumes a $0 fee model.  Very cool model, though :-)

0

I'm really new to this, but how would you attach fee's to this? 

0

Hi, Hector,

Marcus set zero fees with code line #18:

Securities[symbol].FeeModel = new ConstantFeeModel(0.0m);

 You can attach fees in three ways:

  1. Remove that line and get the default fee model;
  2. Define your own custom fee model. Click here for an example.
  3. Use ConstantFeeModel with a different fee (e.g. $1):Securities[symbol].FeeModel = new ConstantFeeModel(1.0m);

     

0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


I was able to add the fee's. Thank you.

0

Im new at programming but, even newer at trading. I stumbled upon this site and wish I did earlier! mainly just wanted to say hey, cool project! and curious if any of you have tried this one out live yet?
0

Is there a way to add foxre commission per trade?

0

@Hector, you can use the FxcmFeeModel to use real commissions applied by FXCM with this line:

Securities[symbol].FeeModel = new FxcmFeeModel();


 

1

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Awesome! Thank you so much! 

0

So i tried implementing this strategy into my risk control and volatility framework to see how it perfoms. I used two types of exit signals, First was the one which was originally implemented in the post and the second is the profit target exit signal with a target ratio of about 0.125 with a risk per trade of $40. Also I am using a portfolio of about 4 symbols rather than just one.

The only problem I think with this strategy is that it trades a lot which really amps up the fees a lot. If we could find a way for this strategy to trade "less frequently" then we can definitely make this strategy profitable. Currently I am using a constant fee model of $0.04 just so we have some kind of a fee applied inorder to see how the risk control model work with this.

I am attaching both the results below with the two exit signals.

First is the one with the profit target exit signal.


I would love to know what the others think about it. :)

0


Hi. I am new here. What is the data you used for this algo? S&P Futures?
0

can you explain the trading rules to enter and exit the trades? a 5 bar high fractal is nothing more than a swing high with 2 lower highs to the right and left of the swing high, as is the 5 bar low fractal, a swing low, with 2 higher lows to the right and left of the swing low. NOW HOW DO YOU ENTER A TRADE, WHAT LOGIC DETERMINES THE ENTRY, AND THE EXIT. ???

1

Hi. I'm new at this (just signed up yesterday) but it seems to me that the strategy always trades at the price of the bar that triggered the event. I could see that happening once in a while but it seems to happen all the time. Other software works as follows:
(1) Triggering event
(2) Order is placed
(3) Order Executed
On market orders you typically get the WORST price available.

On the bright side, if you run the algorithm with an expensive instrument (i.e. REGN, BIIB, etc.) it does very well without worrying about the commission.

Am I missing something? Thanks, Mike
0

no you are not missing anything, but if you can can you explain the entry and exit logic for the system. Can the developer at least help me in that regard?

0

LIz,

The logic is simple and straightforward.  Look back and make the bar 3 bars back (as defined, or the middle bar) is the lowest or highest.  It is looking for a reversal within two bars.  I just don't understand how the order is executed on the price of the current bar.

0

e.g., you have a swing high with a strength of 2, (rename it a 5 bar fractal high), that is, a high with 2 lower highs to the right and left, when you complete the pattern, am I assuming you then enter short at the current bars close? converse for a long.

therefore you have a reversal system, long short long etc.  Does the code verify this? and what interval is being tested, daily, intraday?

0

I believe it's doing daily per minute. 

0

If only we could live in a world without fees
0

What time frame are these trades based off of?
0

What time frame are these trades based off of?
0

nice
0

I tried to test it but I get:
"You have exceeded maximum number of orders (10000), for unlimited orders upgrade your account"
So looks that strategy keep opening trades.
0

@ Mars,

i think it means: if you didn't upgrade your account to pro you are only allowed to test your strategies with 10 000 Orders max. ..... everything works as expected..... :)

You can see it on the stats below your backtest that it did 10 001 Orders? right?

best regards

 

0

Hello Marcus,

I was trying to backtest your algo and it is giving me an unsual error:

"19:29:08: Runtime Error: Could not load file or assembly or one of its dependencies. (Open Stacktrace) "

Do you know what could be wrong?

0

It looks like the Accord.Extensions 3.0.1 library (last updated more than a year ago) is not compatible with the latest Accord.NET 3.3.0.
For this algorithm the problem can be solved by removing the dependency on the Accord.Extensions library (including only the two required source files in the project)

 

 

4

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Accor.Extensions is Unknown
0

just clone this and can't be built properly: how an i solve this?
Build Error: File: FractalChannel.cs Line:1 Column:884 - The type or namespace name 'Extensions' does not exist in the namespace 'Accord'

how do i add the Accord assembly when doing backtest in the ide?
0

David Tan Ahmad Lutfi Stefano wrote a new version above which imported the required extensions.

The difference is massive now that we've incorporated spread into the algorithm. Its almost 90% loss!

0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Update Backtest





0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Loading...

This discussion is closed