MQ4 Code Works

hayseed

Master Trader
Jul 27, 2010
1,046
262
149
usa
How do
You determine what family an indicator belongs to? And do you have a preference of order?

For example trend first, strength second? Or does it simply not matter?

I’ll sue your info from a couple of posts ago as a guide. But I’ve never fully grasped what is strength vs trend etc
//----

there are some basic guidelines ..... some might fall into two classes..... expect some disagreements on the class at times, everybody has an opinion..... and of course we have some ability to reclass them to our fancy...... again, everybody has an opinion........

investopedia......

stockcharts.....

here is what i have so far...... will post the code and video explaining it later...... the code will be very easy to personalize, add to or edit...... very very easy..... you need to be able to write it in your mind......

might have to buy bigger computer..... these cheap 300$ hp"s don't have a large enough screen for this......

be forewarned, if priscilla throws a fit about having another computer in the house, i'm blaming you......h
//-----
usdjpy-d1-ftmo-s-r-ftmo-progress.png
 

TradeChaser

Active Trader
May 12, 2020
161
6
34
32
I am trying this as well. My MT4 keeps freezing. The only problem is I know I have compiled heavier code in the past, and I simply can't see what the error would be causing this to freeze.
 

Attachments

  • Everything2.0.ex4
    34.1 KB · Views: 6
  • Everything2.0.mq4
    13.6 KB · Views: 9

hayseed

Master Trader
Jul 27, 2010
1,046
262
149
usa
I am trying this as well. My MT4 keeps freezing. The only problem is I know I have compiled heavier code in the past, and I simply can't see what the error would be causing this to freeze.
//---

remove the alerts...... simplify the code..... start with 1 indicator..... verify it works..... verify the signals are correct on all pairs all timeframes....

then do the same on the next indicator......

go to extremes in keeping the code simple, neat, orderly and identical as possible.... think as if every letter costs a dollar.....

imagine how hard it must be to play cannon d from memory..... they learn to do it ......

you can do it..... start with the awesome indicator.... in your mind, write the simplest code to test iao above below 0......

Code:
 color clr    = clrRed;
 int   wing   =  234; 
                                      
 if(iAO(symbol,tfs[j],0)  >  0.0)     {clr = clrLime;  wing = 233;}
//-----


keep it simple...... i would not let the girls even use paper.....h
 

TradeChaser

Active Trader
May 12, 2020
161
6
34
32
Will get back to it! I found out right after I posted that that the biggest issue was having NZDCAD. My broker doesn’t support that for some reason so it froze looking for it.

Still sluggish so I’ll work on cleaning it up.

Although, I will say, I didn’t realize you used the “0” index to look at current candle in I will have to look at my indicators again and rewrite
 

hayseed

Master Trader
Jul 27, 2010
1,046
262
149
usa
NZDCAD. My broker doesn’t support that for some reason so it froze looking for it.

I didn’t realize you used the “0” index to look at current candle in I will have to look at my indicators again and rewrite
//----

that will do it.....

i look at the 0 bar when trying to do the impossible...... otherwise it's usually the 1 and 2 bars back......

to a small degree it depends on the indicator, timeframe and time left in the bar.....

such as, if the price breaks the weekly psar at 1 am tonight, i don't want to wait till next week to move......h
 

TradeChaser

Active Trader
May 12, 2020
161
6
34
32
That makes a lot of sense! I am curious, do you use different settings then standard for your QQE? your indicator always looks way more smoothed than mine. I looked into your videos, and it looks like it shows "QQE(5)", and 5 looks like the only extern variable to change, so my gut makes me think I am using the same settings. But it looks so different.

1658696440014.png
 

TradeChaser

Active Trader
May 12, 2020
161
6
34
32
1658701465003.png

I am getting closer... Stuck somewhere else now... At random, it appears that I am getting an error regarding the alma... Terminals says:
1658701431261.png

Below is the code for the alma logic. All arrows are drawn down and red. Then logic checks to determine if they should be a different color. I went back to started with Index 1 instead of 0 incase that was my issue, but it didn't fix anything.

Code:
// Indy 7
wing = 234;
color1 = clrRed;

if(iCustom(pair, timeframe,"alma",0, 1)  > iCustom(pair, timeframe,"alma",0, 2))               {color1 = clrLime; wing = 233;}
if((iCustom(pair, timeframe,"alma",0,1)  > iCustom(pair, timeframe,"alma",0, 2))
&&
(iCustom(pair, timeframe,"alma",0, 2)  < iCustom(pair, timeframe,"alma",0, 3)))             {color1 = clrBlue; wing = 233;}
if((iCustom(pair, timeframe,"alma",0, 1)  < iCustom(pair, timeframe,"alma",0, 2))
&&
(iCustom(pair, timeframe,"alma",0, 2)  > iCustom(pair, timeframe,"alma",0, 3)))            {color1 = clrMagenta; wing = 234;}


The second to last line below from the indicator that is giving me trouble. It is from the init() section of the alma indicator, so I can't imagine why that it not allowing it to get the data.

Code:
int init()
  {
//---- indicator buffers mapping
   IndicatorBuffers(5);
   SetIndexBuffer(0,ALMA);
   SetIndexBuffer(1,Uptrend);
   SetIndexBuffer(2,Dntrend);
   SetIndexBuffer(3,trend); 
   SetIndexBuffer(4,Del);
//---- drawing settings
   SetIndexStyle(0,DRAW_LINE);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexStyle(2,DRAW_LINE);
   draw_begin = WindowSize;
   SetIndexDrawBegin(0,draw_begin);
   SetIndexDrawBegin(1,draw_begin);
   SetIndexDrawBegin(2,draw_begin);
   SetIndexShift(0,Shift);
   SetIndexShift(1,Shift);
   SetIndexShift(2,Shift);
   IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)+1);
//---- name for DataWindow and indicator subwindow label
   IndicatorShortName("ALMA("+WindowSize +")");
   SetIndexLabel(0,"ALMA");
   SetIndexLabel(1,"ALMA Uptrend");
   SetIndexLabel(2,"ALMA Dntrend");
//----
  
   double m = MathFloor(Offset * (WindowSize - 1));
    double s = WindowSize/Sigma;
    
    ArrayResize(wALMA,WindowSize);
    double wsum = 0;       
    for (int i=0;i < WindowSize;i++)
    {
    wALMA[i] = MathExp(-((i-m)*(i-m))/(2*s*s));
   wsum += wALMA[i];
   }
  
   for (i=0;i < WindowSize;i++) wALMA[i] = wALMA[i]/wsum;
  
  
    atr = NormalizeDouble(iATR(NULL,0,100,1)*0.5,Digits);
 

hayseed

Master Trader
Jul 27, 2010
1,046
262
149
usa
the alma itself should not be the problem.....

sounds like a data issue....... make sure you have usdchf data and also make sure the terms pair and timeframe are correct......

if all the arrows are incorrectly down and incorrectly red it means that none of the conditions were true so the default values are used...... so make sure your conditions wording is correct.....

insert the name of the indicator in one of the blank spots.....

once the dashboard is finished, write a alert only ea to alert on buy/sell conditions.....h
//----

Code:
           if((symbol != ""))
           {                     
           Display(symbol+" bbands "+IntegerToString(tfs[j])+ " "+IntegerToString(i),  1500+(j*20),20 +(i*19));                 
           ObjectSetText(symbol+" bbands "+IntegerToString(tfs[j])+ " "+IntegerToString(i), CharToStr(wing),10,"Wingdings",clr);
           }
          
           if( (i==15)&& j==3)
           {                     
           Display("bbands",  1500+(j*20),20 +(i*19));                 
           ObjectSetText("bbands","bbands",10,"Verdana",Aqua);
           }


//----
usdjpy-d1-ftmo-s-r-ftmo.png
 

TradeChaser

Active Trader
May 12, 2020
161
6
34
32
Excellent insights! I will try debugging, but I may just cut Alma altogether and mirror your dash so we are looking at similar things.

Should be able to complete the dash script tonight.
 

TradeChaser

Active Trader
May 12, 2020
161
6
34
32
I think I messed up. are your columns by indicator, or are they by timeframe?
like my first column is all of the weekly, moving left to right by indicator. then by daily...
 

TradeChaser

Active Trader
May 12, 2020
161
6
34
32
Well, I think i've done something. Made two dash's. One by Time frame, and one by indicator (as I believe you did). the latter is imaged. I also created my EA. I am not sure if I did it as you would have done, but I simply made an EA to scan all objects, check color, and if color is blue/magenta... act accordingly.

Although, I am not sure if your 150 MA was simply a slope check or price is below/above. Also, with zzleg, I know how to check dxn, but I have never understood how to check if it's a new leg and not just the same leg continuing.

1658807819401.png
 

Attachments

  • EVERYTHING3.0.mq4
    66.5 KB · Views: 9
  • Display.mqh
    2.3 KB · Views: 11
  • Alerts.mqh
    8.6 KB · Views: 11
  • zigzags.mqh
    21.2 KB · Views: 11
  • Hayseed_AlertSearch.mq4
    6.6 KB · Views: 14

hayseed

Master Trader
Jul 27, 2010
1,046
262
149
usa
Well, I think i've done something. Made two dash's.
//----

your code layout looks better and better..... almost like slowly stepping down same sized steps....

keep striving to reduce it further while maintaining just enough to be clear.....

give your eyes a break.... keep as much on a line as possible.... avoid splitting sentences......

the 150 ma is meant to be long term trend filter...... actually meant for it to be 100....

try to group your alerts by currency groups by pair.....h
 

hayseed

Master Trader
Jul 27, 2010
1,046
262
149
usa
are you saying like this?
//----

that's good but look at the pound pairs..... see how they are kinda scattered.....

if you group them like your doing, pound, yen and so on first, then ran thru that group by pair and timeframe.....

then all the pound pairs would be together further dived by pair then timeframe.....

so at a glance you could visualize the pounds strength along with signals.....

once you have that ironed out, consider additional comments......

like "place trailing psar sellstop'".... or "blast with sell, sellstop, selllimit grid".... "place fractal 240 buystops"......

the more descriptive the comments the less thought is required in the heat of the moment.....h

//-----

group.jpg
//-----

group 2.jpg
//---
 

hayseed

Master Trader
Jul 27, 2010
1,046
262
149
usa
i didnt really look at that picture till now..... it is easy to see the euraud movement because they are all grouped together.....

have not looked at the calendar but aud must have had some noteworthy news or data in the last 30 minutes.....h
 

TradeChaser

Active Trader
May 12, 2020
161
6
34
32
think I finally have it.

1658896391363.png

I can see that you are leading me to water. I will ponder the additional comments... I see now your comments about the signal being immaterial...

where I have pause is knowing when to lead with a PSAR trailer (although I assume it would be when you get an opposing signal Like break up on the M30 when the greater trend is down. The trailing stop will catch the return of the trend), or to blast a grid instead of hitting the zz leg with fibo orders.

It kind of leads me back to some of my previous questions - if I get an M30, does it need to agree with H1, H4, D1, and W1? Or is it really just D1 you’re concerned with?

I fully recall the thought exercise of reviewing the indicators and asking “do you really want to be selling when the QQE is above 50?” But when You get to the smaller timeframes signals, I’d love to understand better where your eyes go from there
 

hayseed

Master Trader
Jul 27, 2010
1,046
262
149
usa
think I finally have it.



I can see that you are leading me to water. I will ponder the additional comments... I see now your comments about the signal being immaterial...

where I have pause is knowing when to lead with a PSAR trailer (although I assume it would be when you get an opposing signal Like break up on the M30 when the greater trend is down. The trailing stop will catch the return of the trend), or to blast a grid instead of hitting the zz leg with fibo orders.

It kind of leads me back to some of my previous questions - if I get an M30, does it need to agree with H1, H4, D1, and W1? Or is it really just D1 you’re concerned with?

I fully recall the thought exercise of reviewing the indicators and asking “do you really want to be selling when the QQE is above 50?” But when You get to the smaller timeframes signals, I’d love to understand better where your eyes go from there
//---

that looks much better..... now think of a manner to include the atr left on the alerts timeframe,, perhaps only the timeframes that might prompt you to trade........ the point is to avoid taking signals where excessive movement took place on that bar.....

the psar trailing or trend line trailing at night mostly for freebie trades...... most close before morning.... at least thats the plan....

imagine the 240, daily and weekly trend is down and you have open shorts..... if the 15,30 or 60 zigzags are up and the psar is below, i'll place a trailing sellstop on the psar..... usually i'll use the one that should activate just before or doing the london open..... in other words if the 60 psar is 200 pips from the price i'll pass....

the best entrys for the larger timeframes are often the the opposing signals on lower timeframes....

no kidding, your alerts look good....h
 

TradeChaser

Active Trader
May 12, 2020
161
6
34
32
//---

that looks much better..... now think of a manner to include the atr left on the alerts timeframe,, perhaps only the timeframes that might prompt you to trade........ the point is to avoid taking signals where excessive movement took place on that bar.....

the psar trailing or trend line trailing at night mostly for freebie trades...... most close before morning.... at least thats the plan....

imagine the 240, daily and weekly trend is down and you have open shorts..... if the 15,30 or 60 zigzags are up and the psar is below, i'll place a trailing sellstop on the psar..... usually i'll use the one that should activate just before or doing the london open..... in other words if the 60 psar is 200 pips from the price i'll pass....

the best entrys for the larger timeframes are often the the opposing signals on lower timeframes....

no kidding, your alerts look good....h
I will chew on this.

How do you look for ATR left? Is it simply the ATR with a period of 1 and shift of 0? Or just High - Low compared the current ATR?

Secondly, for my alert, are you interested in the Daily candle, despite the time frame of the trigger?

And I suppose the weekly TF for D1 (or maybe H4) and above?
 

hayseed

Master Trader
Jul 27, 2010
1,046
262
149
usa
How do you look for ATR left? Is it simply the ATR with a period of 1 and shift of 0? Or just High - Low compared the current ATR?

Secondly, for my alert, are you interested in the Daily candle, despite the time frame of the trigger?

And I suppose the weekly TF for D1 (or maybe H4) and above?
//-----

i do it multiple ways depending on how it's used....... sometimes just a stand alone function..... thats probably best..... sometimes the values are loaded into a array....

below is another way were its hard coded.....

the daily and weekly pull the most weight with me.... thats why i like placing trades for tomorrow over the next few hours...... we have all most the full atr available to us......

once weekly atr is gone, new trades even on valid signals seem to suffer.....h
//-----

Code:
          Display("daily atr"+sym,  1250 ,40 +(i*29));
           ObjectSetText("daily atr"+sym, DoubleToStr((iATR(sym,1440,300,1)/MarketInfo(sym,MODE_POINT)*0.1),0), 10, "Verdana", clrAqua);
          
           double today = iATR(sym,1440,50,1) -(MathMax(MarketInfo(sym,MODE_POINT),(iHigh(sym,1440,0)-iLow(sym,1440,0))));

           Display("atr left"+sym,    1300 ,40 +(i*29));
           ObjectSetText("atr left"+sym, DoubleToStr((today/MarketInfo(sym,MODE_POINT)*0.1),0), 10, "Verdana", clrYellow);
 

TradeChaser

Active Trader
May 12, 2020
161
6
34
32
I will definitely use that MathMax. That’s a really good idea. I will put this to some code and put it to work next week. I have some grid scripts and the PSAR stop I can do for sure. PT I suppose I will keep conservative.

I rewatched about old video about exporting to Excel. I remember you staid that you wanted to see if you could just buy and sell every candle, and it didn’t work out.

I’m curious if you found anything else out… like if the sum of your indicators was above 10, was there any statistically significant likelihood that the next candle up direction would be greater then the ATR for that time frame?

Or any statistically significant likliehood that the up side of the candle was “X-times” larger than the bottom wick?