MQ4 Code Works

TradeChaser

Active Trader
May 12, 2020
161
6
34
32
Ha it will have to tick for me, but get some pips for me. Can’t tel you how accomplished I felt just getting those numbers to print out in Dash form. I’m very analytical, so I get caught down the rabbit hole.

Would love to see how average length of a signal changes based on upper time frame. That is to say, if you caught the first new signal on a 240 of an existing signal on the daily, how much does that differ from the average? Is that statistically significant? Maybe it doesn’t matter.

I have a new respect with your wick measurements though.

Perhaps you are in a Red 2 on the monthly, and a red 1 on the weekly (an otherwise health bearish sentiment).

Maybe on your 4H red 0, you place a single open order at the next candle… maybe a pending order where you think the wick will hit?

Reminds me from that video you posted, “what’s stopping me from buying here (open of new candle)”.

You could also ask, what’s stopping you from buying/selling the wick?
 

hayseed

Master Trader
Jul 27, 2010
1,013
258
149
usa
Would love to see how average length of a signal changes based on upper time frame. That is to say, if you caught the first new signal on a 240 of an existing signal on the daily, how much does that differ from the average? Is that statistically significant? Maybe it doesn’t matter.
//-------

it does not matter, they are almost identical.....

when the trend is clearly down, try entering on the lower timeframes zigzag legs that oppose the trend...... so if the trend is down, consider selling the zigzag up legs.....

i'll send a sell with a selllimit maybe 10 pips above that..... depending on the counts i might send more and space them closer..... remember, my trades are small....

for almost all indicators, there is a predictable number of signals and average length.... there is a predictable ratio of signals on those timeframes.....

just as a widely inaccurate example, for every single 10080 zigzag leg, there will be 5 daily zigzag legs in that period of time..... there will be thirty 240 zigzag legs, 780 sixty minute legs and so on with ever increasing legs as the timeframes get smaller..... during that single weekly legs length......

and remember, those numbers i used are made up just to explain.....

just think about it and you'll see.....

imagine selling every 60 minute up zigzag leg during that single weekly down leg.....

of course you can sell every one so you have to make up for it with multiple sells on the ones you can......

the 60 minute zigzag legs extend/repaint an amount which is why i place the additional sell limits above.....

just think about it and it should come clear......h
 

TradeChaser

Active Trader
May 12, 2020
161
6
34
32
Oh I promise I get that. You’re speaking my language and I love the idea. Same loose premise I use for my long-term investing… I hate buying on green day’s. In fact I tried to trade that in Forex but failed because I couldn’t code it:

Trend is up. Smaller tf retraces. Leg into the retrace and simply make the recent high a target. It cuts winners, but it is an interesting premise for sure and I think I get what you’re saying.

Honest question though, why the ZZ over your MA indicators? I definitely appreciate the Sawteeth reasoning. But wouldn’t the various ups and down signals of the ALMA or TSR (on small TF) give you, in essence the same story with no retracing?


Like if the Weekly is up, and you bought every new candle on the 60 after the TSR hit Red “X”. Would you not get a similar entry to the ZZ but with no repaint risk?

To be candid, I personally have trouble reading ZZ code, so that might be the biggest issue - me not knowing just how ZZ can be leveraged.
 

hayseed

Master Trader
Jul 27, 2010
1,013
258
149
usa
Honest question though, why the ZZ over your MA indicators? I definitely appreciate the Sawteeth reasoning. But wouldn’t the various ups and down signals of the ALMA or TSR (on small TF) give you, in essence the same story .
//-----

perhaps..... the weakness of moving averages is in the price movement required to change the signal...... that amount can add up as quite an opportunity lost..... just look at the movement required to turn the tsr(89).....

where the zigzag is an exact extreme point...... it can and almost always extends some but thats ok..... placing a limit order at that point, you can assure that entry...... if the price continues that is......

i just place a few limits spaced around it and call it good......

and, because my lot size is so small, any other signal can be taken also......h
 

TradeChaser

Active Trader
May 12, 2020
161
6
34
32
Would you be willing to make a video explaining ZZ code?

I don’t want to reinvent the wheel, but when trying to code things from it, I have a very hard time understanding what is what I’m the ZZ Code just by looking at the arrays and variables.

I will keep looking regardless, but It would be a tremendous help!
 

TradeChaser

Active Trader
May 12, 2020
161
6
34
32
Quick question if you will. I am trying to emulate the ATR dashboard you made... I was having trouble, so started troubleshooting via code (that will explain the image... the code pictured is not very useful). I could not tell if I was using iBars() correctly, so I decided to make two rows of ATR... One with set length of 14, and the other with iBars.

The issue is when I am trying to use iBars to set the length of the ATR, everything comes up "0's" on the dashboard. The stranger thing is, if I change:

Note, pairs[] and tf[] represent global arrays created to iterate through tf and currency pair.

//---
int bars = iBars(pairs, tf[j]);
double TotalATR = iATR(pairs, tf[j], bars, 0); //If I change this line to the line below, it works:
double TotalATR2 = iATR("EURUSD", tf[j], bars, 0); // Of course it only populates the ATR for EURUSD.

In a nutshell, the top line computes fine in my dashboard across all pairs and all time frames. However, when I am index slicing for pairs in the second line, for some reason all of a sudden it will just compute to 0.

Below is an image to show more. Do you have any idea why the code is simply deciding to accept pairs in the first line, but not the second?

1650427233954.png
1650427702436.png
 

hayseed

Master Trader
Jul 27, 2010
1,013
258
149
usa
//-----

run a second for(int j=0; for the second display.....

best to move the int j part out of the for....

will explain better later...h
Post automatically merged:

watch the eurjpy and audnzd.....h
 

TradeChaser

Active Trader
May 12, 2020
161
6
34
32
Thanks for the insights! A little more tinkering... it turns out my error is with iBars... I guess there was an overflow or something...

Instead of making the length iBars(pair, tf[j]), I had to make it iBars(pair, tf[j]) - 1.
 

TradeChaser

Active Trader
May 12, 2020
161
6
34
32
@hayseed - Have you ever data mined wicks info? I was thinking as I said above or on another thread... if you get a signal, you could enter on the new candle... OR you could throw a line in the water.

Just wanted to see what the average proportion of a candle is wick. I was actually pretty surprised to see it so clean, unless of course my data is bad.

seems to me you could just put a pending order 25% below the open and wait and see. Of course, statistically speaking, you'd expect less bottom wicks in an uptrend, so maybe you'd only shoot for 10% of ATR for the pending... but if you look at a daily AUDCAD... 25% is about 15pips... 15 pips added to your trade.

1650601308727.png
 

hayseed

Master Trader
Jul 27, 2010
1,013
258
149
usa
you could just put a pending order 25% below the open and wait and see. Of course, statistically speaking, you'd expect less bottom wicks in an uptrend, so maybe you'd only shoot for 10% of ATR for the pending... but if you look at a daily AUDCAD... 25% is about 15pips... 15 pips added to your trade.
//------

that's the wall of worry and the slope of hope effect.....

in a downtrend with acceptable counts and correct zigzag , i'll double the lot size in selllimits compared to the sellstops......

both will cover half the atr in both directions..... so roughly 100% of the atr is covered with pendings......

but only in a downtrend with acceptable counts and correct zigzag........ so 0.01 sellstops and 0.02 selllimits......

if its a monthly trade, i only use 0.01.......

and a whole herd of'em......h
 

hayseed

Master Trader
Jul 27, 2010
1,013
258
149
usa
now i'll begin to swing it all to some pre-emptive countertrend trades for may......

and probably end up washin dishes at subway.....h
//-----
//------

do you have your 500 pip monthly trade for may figured out yet...... only 9 days left......

clocks tickin..... markets wait on no one......h
 

TradeChaser

Active Trader
May 12, 2020
161
6
34
32
I hear ya! Just still trying to figure out ZigZag! I just may be operational by May. A lot is coming together.
 

hayseed

Master Trader
Jul 27, 2010
1,013
258
149
usa
I hear ya! Just still trying to figure out ZigZag! I just may be operational by May. A lot is coming together.
//-----

0,1,2,3......h
//-----

nzdcad-w1-oanda-division1.png

//-----

audcad-w1-oanda-division1-weekly.png
 

TradeChaser

Active Trader
May 12, 2020
161
6
34
32
Hayseed,

How do you build your ZZ dash or get ZZ signals? I have looked at the indicator for hours, and tried to play with scripts to see what buffer I need to try to access, but I am not understanding how to extract the extremes of the zig zag in order to create the green/red style dash and bar counts.

Any assistance is greatly appreciated!
 

hayseed

Master Trader
Jul 27, 2010
1,013
258
149
usa
tried to play
//----

better quit playing around with zigzags and find me 5 trades that will make 50$ each next week.... priscilla needs here taco bell money.......lol......

and don't forget about my trades for next month...... times running out..... need 200 profitable trades on a single chart at the same time......

theres a 1969 ford 3000 tractor for sale on facebook market place that only had 12 previous owners...... 200 trades might buy it......

somebody has to be 13......h
//------

Image.jpeg

//-----

 

Attachments

  • 1.mq4
    917 bytes · Views: 28
  • 1.ex4
    9.8 KB · Views: 15
  • Display.mqh
    721 bytes · Views: 24
  • zigzags.mqh
    1.9 KB · Views: 16
  • 👍
Reactions: Enivid

hayseed

Master Trader
Jul 27, 2010
1,013
258
149
usa
Getting there... It ain't much, but it's honest work.
//-----

it's not work if you truly enjoy it......

you better get priscillas trades for next week..... she's givin me the evil eye........

need, five 1 mini lot lot trades on 2 pairs that will make 50$ each next week..... 10 trades total.... no aud trades.....

need them by tomorrow..... today would be better..... for next sunday.....

should be easy....... no losers.....h
 

TradeChaser

Active Trader
May 12, 2020
161
6
34
32
Hayseed,

I am hoping with my progress that you can help me begin to see the light...

Below dashboard is across 7 timeframs, and is ordered by JJMA, JFATL, AO, Alma, PSAR, QQE, TSR60, and TSR89 (based on shortest to longest signal length). Bright colors means current candle is below average signal count. Drab colors means the signal is past its average.

The picture below that is the pips per .1 lot for every pair, and what that is worth based on the current ATR (used length of 150 to sample a lot of candles for ATR)

The issue is, I don't know how to enter. Look at GBPCAD for example.
Monthly - seems pretty fresh bearish signals
Weekly - quicker signals are past the prime, but longer signals are fresh - good for long term bearish, but perhaps short term bullish on the horizon
Daily - All bearish signals look like they are creeping past the prime
240 - same
60 - some of the quicker signals (JFATL, AO, Alma) seems fresh,
30/15 - seeing some very small, short term bullish trends here. but this is just noise to anything 240 and above I would guess..

My thesis says that the trend is clearly bearish, but all signals point to exhaustion. Now, there could also be a fundamental driver pushing it down, in which case technicals be damned.

then I look at the chart... And I neither want to buy or sell that thing.

I believe I understand how to capture the length of the signal, how that computes against lot size, and how to forecast potential trade worth... but what I have the hardest time understanding is how to take a methodical approach to the mosaic below (dashboard). I feel like it gives me so much conflicting information that I have a really hard time taking action from it.

Again, I hope you see my trying to really sweat and learn. I love the analysis and all of the data. The execution just escapes me in trying to find the trades with 'no losers'.

Dashboard with candle counts:
1651155862981.png

ATR/$ perPip

1651155887525.png
 

hayseed

Master Trader
Jul 27, 2010
1,013
258
149
usa
The issue is, I don't know how to enter. Look at GBPCAD for example.
Monthly - seems pretty fresh bearish signals
Weekly - quicker signals are past the prime, but longer signals are fresh - good for long term bearish, but perhaps short term bullish on the horizon
Daily - All bearish signals look like they are creeping past the prime
240 - same
60 - some of the quicker signals (JFATL, AO, Alma) seems fresh,
30/15 - seeing some very small, short term bullish trends here. but this is just noise to anything 240 and above I would guess..

My thesis says that the trend is clearly bearish, but all signals point to exhaustion. Now, there could also be a fundamental driver pushing it down, in which case technicals be damned.
//-----

if you give a farmer a crop he can grow and get rich, he will produce himself into bankruptcy almost every time......

be wary of the zigzag(75)...... once it prints, look for another crop....... without a doubt the trend might continue...... you might leave a fortune on the table...... but odds of a 3 day killer retrace will have increased.....

at a minimum, wait for a daily zigzag(12) leg against the zigzag(75).....

the sell signal was a couple months ago..... for me, the risk is not worth the reward...... the goose is almost cooked......

might be better fish to fry......h
//------
gbpcad-d1-oanda-division1-wary-of-the-75.png