DollarBars VolumeBars Marcos Lopez Advances in Financial Machine Learning

Questions about MultiCharts and user contributed studies.
amw_775
Posts: 23
Joined: 19 Apr 2020
Has thanked: 1 time
Been thanked: 11 times

DollarBars VolumeBars Marcos Lopez Advances in Financial Machine Learning

Postby amw_775 » 25 Jul 2022

Hi

I have coded Custom Resolution for Dollar Bars and Volume bars as per the logic in the book from Marcos Lopez de Prado Advances in Financial machine Learning.

I use the Custom Resolution Manager ( in Multicharts ) and have created the plugin.
DollarBars: It uses DollarBars that generate a new DollarBar everytime a thresholdA is exceeded.
VolumeBars: It uses VolumeBars that generate a new VolumeBar everytime a thresholdB is exceeded.


As per Marcos Lope'z book's recommendations for the threshold's are:
Threshold A is the Moving Average of the Last 30 daysDAILY DollarValue divided by 50 (You want to generate approx 50 bars per day)
Threshold B is the Moving Average of the Last 30 days DAILY Volume divided by 50

Threshold Days is a user configurable Number. You can use the last 5, 10 ,20, 30 and so default setting is 30 days. Marcos Lopez recommends 30
Since you need a minimum of N days till the threshold is calculated, therefore when there are less than N days on the chart, the chart uses a Fixed Interval such as 30minutes.

I also use the Tick Rule and Volume, BuyVolume, and DollarValue is accordingly mapped to the following Multicharts reserved Keywords where
Volume: is representing Total Volume
Upticks represents BuyVolume as derived by TickRule
We done need Sell Volume here becuase SellVolume = TotalVolume - BuyVolume So I have mapped
Downticks: represents DollarValue.

So you can directly receive the Tota Volume, Buyvolume and dollar value inside your multicharts strategy or indicator.
The above plugin is also compatible with portfolio trader.

If your datafeed has aggresor flags (i.e. you are already give Buy Volume, SellVolume, and TotalVolume,) then under the FormatInstruments section you can disable my custom calculation of the Tick Rule, Volume, BuyVolume and so on by changing the parameer CalcUpDnVol to 0


The code is still under development The only part that needs work is the GUI settings. You cannot switch to candelstick or HLC or other types of charts directly. You have to click on format instruments>styles> and then select candlestick/barchart or whatever format you like

If anyone is interested in the plugin or any of the code below please PM me


Not only this I also have converted all the Python Code in the Book to EasyLanguage code and the following functions are available:
CUSUM FILTER
Zscore Filter
bvc_buy volume
Amihuds Lambda
Kyles Lamda
Hasbroucks Lambda
Volume Synchronized Probability
Fractional Differenciation
Probability based betsizing
and many more.


I'm also in the process of wirting a Python Bridge which allows Multicharts Powerlanguage to call Python from your strategy.
Attachments
DollarBarFINAL.PNG
(67.51 KiB) Not downloaded yet
image_2022-07-25_185833136.png
(35.29 KiB) Not downloaded yet
DollarbarsVolumeBars.PNG
(159.45 KiB) Not downloaded yet

User avatar
Smoky
Posts: 517
Joined: 03 Dec 2010
Location: Thailand
Has thanked: 99 times
Been thanked: 121 times

Re: DollarBars VolumeBars Marcos Lopez Advances in Financial Machine Learning

Postby Smoky » 22 Oct 2022

Hi


I'm also in the process of wirting a Python Bridge which allows Multicharts Powerlanguage to call Python from your strategy.
Any news ?

amw_775
Posts: 23
Joined: 19 Apr 2020
Has thanked: 1 time
Been thanked: 11 times

Re: DollarBars VolumeBars Marcos Lopez Advances in Financial Machine Learning

Postby amw_775 » 25 Oct 2022

Hi it's almost complete but it has only 10 to 15 existing python function that are used in ML. . If u want to add more python functions then you need to modify the c++ DLL and carry out marshalling

User avatar
Smoky
Posts: 517
Joined: 03 Dec 2010
Location: Thailand
Has thanked: 99 times
Been thanked: 121 times

Re: DollarBars VolumeBars Marcos Lopez Advances in Financial Machine Learning

Postby Smoky » 26 Oct 2022

Hi it's almost complete but it has only 10 to 15 existing python function that are used in ML. . If u want to add more python functions then you need to modify the c++ DLL and carry out marshalling
for the moment i try only to use sharedvar with MC and Python.

amw_775
Posts: 23
Joined: 19 Apr 2020
Has thanked: 1 time
Been thanked: 11 times

Re: DollarBars VolumeBars Marcos Lopez Advances in Financial Machine Learning

Postby amw_775 » 27 Oct 2022

Hows SharedVar working for you ? Because I was facing many issues.
SharedVar was not working or many times would stop transferring data between MC and Python

User avatar
syswizard
Posts: 295
Joined: 15 Dec 2012
Has thanked: 16 times
Been thanked: 28 times

Re: DollarBars VolumeBars Marcos Lopez Advances in Financial Machine Learning

Postby syswizard » 29 Oct 2022

You are doing some really cool stuff...congrats !
Are any of these available with source code ?:
CUSTOM FILTER
Zscore Filter
bvc_buy volume
Amihuds Lambda
Kyles Lamda
Hasbroucks Lambda
Volume Synchronized Probability
Fractional Differenciation
Probability based betsizing
and many more.

amw_775
Posts: 23
Joined: 19 Apr 2020
Has thanked: 1 time
Been thanked: 11 times

Re: DollarBars VolumeBars Marcos Lopez Advances in Financial Machine Learning

Postby amw_775 » 29 Oct 2022

Thanks.

Yes its been over a year of hardwork and effort.

I have re written all the above for EasyLanguage/Powerlanguage. The results are identical to the original functions written by Marcos Lopez.

I'm only using the Python DLL to send my data to the MachineLearning Model to predict the outcome and receive the outcome back.

I have also written custom functions which allow you todo dot product, vector and matrix multiplication.

In addition all the functions mentioned above are calculated within Multicharts.

Incase of any interest please PM me.

Additional Functions for MC/Powerlanguage :
  • Bekker Parkinsons Volatility
  • Parkinsons Volatility
  • Get Betas
  • Roll Impact
  • Roll Measure
  • Get FFD Weights
  • Corwin Schultz Estimator
  • VPIN
  • Bulk Volume Classfication Algorithm (BVC)
  • Daily Volatility ( Regular )
  • Daily Volatility ( Exponential )
  • Exponential Mean / Std Deviation as calculated in Python - Pandas - note that python uses non-recursive calculation for exponential moments which is very different than expoential calculations in MC / Powerlanguage. (https://tedboy.github.io/pandas/computa ... tion5.html)

amw_775
Posts: 23
Joined: 19 Apr 2020
Has thanked: 1 time
Been thanked: 11 times

Re: DollarBars VolumeBars Marcos Lopez Advances in Financial Machine Learning

Postby amw_775 » 17 Jan 2023

Hi All My Python Bridge is complete.

Im able to load Machine Learning models, do prediction, calculate Market Microstructure features, bvc_buy volume
Amihuds Lambda, Kyles Lamda, Hasbroucks Lambda, Volume Synchronized Probability, Fractional Differenciation, Probability based betsizing, and many more bet sizing methods supported in Marcos Lopez's book.

I can also run sftp uploads, a csv dump which saves all variables from powerlanguage to a harddrive in milli seconds

In case of any interest in the Python bridge or DollarBars / Volume Bars do let me know

Salzburg
Posts: 140
Joined: 19 Sep 2018
Has thanked: 9 times
Been thanked: 35 times

Re: DollarBars VolumeBars Marcos Lopez Advances in Financial Machine Learning

Postby Salzburg » 18 Jan 2023

I am interested in the Python bridge, is this proprietary or something you want to share to the community ?

Nice work you done,

amw_775
Posts: 23
Joined: 19 Apr 2020
Has thanked: 1 time
Been thanked: 11 times

Re: DollarBars VolumeBars Marcos Lopez Advances in Financial Machine Learning

Postby amw_775 » 19 Jan 2023

I am interested in the Python bridge, is this proprietary or something you want to share to the community ?

Nice work you done,
Hello

Its propriotory, but I can sell it with full source code.

I had to hire professional programmers to build the python bridge. Most of the code is a C++ wrapper that calls your python functions.
If you do know c++ then you can add more python functions. If not, I can get the same programmer to add it for a some fee.
Blazingly fast.

amw_775
Posts: 23
Joined: 19 Apr 2020
Has thanked: 1 time
Been thanked: 11 times

Re: DollarBars VolumeBars Marcos Lopez Advances in Financial Machine Learning

Postby amw_775 » 05 Jul 2023

Hi Everyone Wanted to update everyone on the DollarBars and Volume Bars

I'm open to sell the custom resolution plug in.
Incase anyone is itnerested please PM.

The way you would use to create chart in Multicharts or Portfolio trader with say a reoslution of 5 minutes, 60 minutes, or 1000 ticks etc.
Now you can Create a chart in Multicharts or Strategy in Portfolio trader to use Dollar Bars or Volume Bars.
You can create Dollar Bars out of Minutes or Ticks depending on your datafeed and PC resources.

You can use the Threshold days to use either 5 / 30 / 60 days or any other number you like.
This configures the lookback days to calculate the moving DollarVolume or volume to use to sample the Bars as suggested in Marcos Lopez's books.

As you can see, by simply changing to Dollar Bars, the profitability of your strategies jumps up drastically. You can see the strategy curve in the background which is after paying 0,2% towards slippage and commissions. Because now your are sampling bars like the proffesionals. You are not using fixed time or tick horizon bars used by the amateurs out there.

You can configure also the CalcUpDnVol parameter to use the famous "Tick Rule" to classify Buy or Sell Volume. As we all know most datafeeds or brokers down't provide accurte volume. One of the best classfication methods out there is the tick rule to accurately classify buyer or seller volume.

When Using Dollar Volume or Volume Bars plugin , the reserved Keywords in multicharts using the Dollar Bars plugin or Volume Bars plugin in that particular chart or for the data series for that strategy will be remapped.

Example if you are using DollarVolume Bars for BTCUSDT in data1, then only for any analysis and indicators applied to BTCUSDT data1 , the following will apply:

TotalTicks represents the total volume.
DownTicks represents DollarVolume of the current bar;

If CalcUpDnVol =1 then ( Useful when your data provider does not provide accurate volume)
UpTicks represents buyvolume classifed by the tick rule;
You can infer sell volume = Totalticks - Upticks


If CalcUpDnVol = 0 then ( Only useful when your data provider provides accurate Buy or Sell Volume)
UpTicks represents buyvolume as provided by your data feed.
Downticks can be configured to your choice whether you want as Downticks as Sell Volume from your data provider or as Dollar Volume.


Image

Image
Attachments
DollarbarsVolumeBars.PNG
(159.45 KiB) Not downloaded yet
DollarBars.JPG
(249.47 KiB) Not downloaded yet


Return to “MultiCharts”