MACD trading

Posted By: udihamudi

MACD trading - 09/04/22 16:28

Hello all,

This is my very first post, I just found Zorro yesterday laugh downloaded and played a little, seems like great stuff. I Have a newbie question and excuse me if this was asked before and answered - is there MACD trading strategy (script) already? For futures / forex. I did not see anything with such content in the strategy folder.

Thanks! have a great weekend!
Posted By: alun

Re: MACD trading - 09/04/22 21:17

I believe you can start with Workshop4.c

and then use MACD indicator to set you own rules for entry/exit https://zorro-project.com/manual/en/ta.htm
Posted By: udihamudi

Re: MACD trading - 09/04/22 22:22

Thanks for the reply! I could not see file called Workshop4.c, only Worhshop_a reference in the above link you provided, where is this file?

Also, I did find the following in Zorro help at
https://zorro-trader.com/manual/en/macd.htm


// when the MACD Histogram goes above zero, buy long
if (crossOver(macdHist(12,26,9),constant(0)))
buyLong(0);
// sell when it goes below zero
if (crossUnder(macdHist(12,26,9),constant(0)))
sellLong(0);


But it doesn't compile, throwing error about macdHist cannot be found. Maybe it's in some external h file?
Posted By: alun

Re: MACD trading - 09/05/22 09:06

Hey udihamudi,

Workshop4 code can be found here https://zorro-project.com/manual/en/tutorial_trade.htm

It should be distributed with Zorro if you downloaded the latest version.


I believe this MACD example that you're looking at is some outdated one.

There are no buyLong/sellLong functions in my Zorro 2.50

instead you're should be using something like:


Code
vars macd = series(MACD(Prices, 12, 26, 9));

if (crossOver(macd,0)) enterLong();
else if (crossUnder(macd,0)) exitLong();


With prices like in workshop 4.



Posted By: alun

Re: MACD trading - 09/05/22 09:55

BTW I found this nice video on the MACD trading - https://www.youtube.com/watch?v=nmffSjdZbWQ

it suggest you use crossover of a macd and singnal lines as an enter signal and use 200 MA as a trend filter for long/short signals.

It's definitely not set in stone, but some ideas to try.
Posted By: udihamudi

Re: MACD trading - 09/05/22 12:27

Great input thanks, I have seen it and looks genuine, even the reading aloud is automated laugh

I have also found this script in github and backtested it, and the result are quite nice, upside of about %20 on EUR/USD 2021-2022-
https://github.com/grat001/5xcor/blob/master/5xcor_jema.c

Of course I would need to modify it for real life scenarios but good baseline showing we can use MACD in Zorro.

Have you had any success using MACD or other indicators in Zorro (or other platforms)?

Cheers

Posted By: alun

Re: MACD trading - 09/05/22 13:39

Nice, you probably need more data/pairs also do a reality check on a de-trended data before running it live.



Originally Posted by udihamudi


Have you had any success using MACD or other indicators in Zorro (or other platforms)?



No I haven't. At least explicitly - not sure if it's used in Z-systems, e.g. Z1 - if yes than this system seems to be successful.

The main problem with MACD that is't lagging - in fact it'd double lagging cause it applies MA to MA.

I'm not a big fan of indicator soups in general.

Also if you haven't seen this - nice article by jcl adding some insight on where the to look for grail system with more probability of finding it laugh

https://financial-hacker.com/please-send-me-a-trading-system/
Posted By: udihamudi

Re: MACD trading - 09/05/22 17:06

Interesting, I wonder if its possible really to "code" market inefficiencies, market model, data mining etc. in a consistent way for a fire-and-forget bot trading, seems like a lot of hand holding required(?) - vs indicator soup, which is probably easier to automate and train for auto trading (but obviously less profitable).

Have you tried automating these different approaches?
Posted By: alun

Re: MACD trading - 09/05/22 21:53

No I don't believe that such strategy exists TBH.

You can have an ideal unbiased WFO-optimised strategy but real-world Sharpe ratio that I usually see is about 1-1.5.

Meaning the ratio of CAGR vs Drawdown/Equity Volatility.

Also drawdown can persist for about 12 months even for the best strategies - so you need some patience to run them.

Strategies making 12% CAGR with reasonable max drawdowns (around 20%) are quite possible.

If you want more profitability that only goes for the cost of extra risks.

Selling options could be profitable IF done right. I've not yet got there myself.

I'm exploiting one ETF based strategy now live. Investing in cryptos long term.
Investing in some top signals of MQL5 with a small fraction of my portfolio.

And just started to play with Z-systems demo-only so far.


Of course that doesn't mean I'm right - that's just my personal way and experience.

You know, Larry Williams made 11376% in 1987 in a public contest with futures trading, turning $10k into $1147k in 1 year.
His max drawdown was over 50% during that contest.
That's an outstanding result, still - achievable.

https://distinct-radio-154.notion.site/Larry-Williams-87-5d242d40743044f880d73609eafa9069
Posted By: udihamudi

Re: MACD trading - 09/06/22 01:53

Which of the Zs are you trying if I may ask? how successful is it so far? when I ran the simulator for Z2 - result are just little better than break-even, including training .. not great frown . The MACD script I found did way better for similar span and same currency (EUR/USD) and I didn't even do any optimization yet.

This Z is concerning me a little, since its kinda black box, isn't that exactly what Zorro warning against in this hacker article laugh you cant's see the source code and obviously can't modify it. Are you comfortable enough to try it in real account?

My "dream" here is to chime in to various live data feeds, stock fundamentals feed etc., maybe throw in some indicators, candlestick/chart pattern, and see if I can I can write algo that will make sense of it all - but I don't know if its possible with Zorro. Use it for either forex or futures.

Outside of this I am playing a little with futures on live account, really little money for now, 80% upside so far but it's been really short time and I am spending way to much time in market research and manual monitoring ... this stuff should all be done by a nice little robot, it's crazy to spend so much time on this mechanical work and there is no reason not to automate if I can qualify my strategy

Have good week!
Posted By: alun

Re: MACD trading - 09/06/22 08:44

I'm trying Z1 which is trend following portfolio of strategies. Backtest using 8 years data from Dukascopy currencies and CFD looked good. Trying live on a demo now. Current result +600$ in two trades it made so far grin

Z2 is mean reversion. Which supposed to be coupled with Z1 and there is Z12 which does white (Zorro S only).

Well I'm investing in signals for many years which are the same blackboxes - you just need to accept 100% deposit risk. And only put small fraction of your portfolio into this game.

On the other side some of those signals making more 5000% over the span of few years. So I look at it as 50:1 risk reward investment.

I'm looking at the Z1/Z2 systems the same way - I find their performance on backtests very good for my needs. I only hope there is no look ahead or selection bias.

With signals there is definitely selection bias (survivorship bias) but the monitoring is of live trading not backtest so at leat the look-ahead is excluded.

You can use Zorro for stocks there is nothing in relation to fundamentals analysis in its standard toolset. But you can load/process the data in Zorro manually.

Best luck with your futures stategy.
Posted By: alun

Re: MACD trading - 09/06/22 10:04

Here is another MACD BTW - https://github.com/jrathgeber/Zorro/blob/master/Strategy/macd.c
Posted By: udihamudi

Re: MACD trading - 09/06/22 23:55

Thanks for sharing!! Congrats on the successful trade laugh I have td ameritrade account, maybe I can try the z1 there, probably need api key, wil update you
Posted By: udihamudi

Re: MACD trading - 09/06/22 23:57

Btw where are the z systems documented?
Posted By: alun

Re: MACD trading - 09/07/22 15:33

Not sure about Ameritrade, Z1 trades mainly Forex and CFD based.

I doubt Ameritrade gives you CFD as you'd rather have normal stocks and futures.

Yes ZSystems are documented here https://zorro-project.com/manual/en/zsystems.htm
Posted By: udihamudi

Re: MACD trading - 09/08/22 20:48

I been chasing TD Ameritrade support and you right, they have API but it only allowing stocks, no futures or forex (which is what I want). Which USA broker would you recommend that works well with Zorro for futures / forex? btw CFD is not allowed in US.

I have also Tastyworks but their API is still in development so can't use it. I have also Fidelity but no API.

Cheers
Posted By: AndrewAMD

Re: MACD trading - 09/08/22 21:11

Oanda, hands down.
Posted By: udihamudi

Re: MACD trading - 09/09/22 18:09

Do you know if I can use free zorro to enter orders for Oanda?
Posted By: AndrewAMD

Re: MACD trading - 09/09/22 18:14

Yes, Oanda is free to use with Zorro:
https://zorro-project.com/manual/en/restrictions.htm
Posted By: udihamudi

Re: MACD trading - 09/09/22 20:12

Does the free zorro allow to send orders to Oanda or just get historic data? Can it subscribe to real time market data from Oanda?

Is all this documented per broker laugh

Thanks!!
Posted By: AndrewAMD

Re: MACD trading - 09/09/22 20:17

Originally Posted by udihamudi
Does the free zorro allow to send orders to Oanda or just get historic data? Can it subscribe to real time market data from Oanda?
Yes, yes, and yes.
Posted By: AndrewAMD

Re: MACD trading - 09/09/22 20:18

Originally Posted by udihamudi
Is all this documented per broker laugh
This is also a yes. There's a manual page for every broker plugin.
Posted By: udihamudi

Re: MACD trading - 09/09/22 22:10

Great thanks! Can you point me to the above documentation?
Posted By: AndrewAMD

Re: MACD trading - 09/10/22 11:19

You must be new here if you don't know how to find it.

Open Zorro, click [Help]. On the left, go to the Search Tab, and type "oanda" and hit enter. It's the first match.
© 2024 lite-C Forums