![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello,
I hope someone can help in getting an indicator to do what I like it to do.
I have an indicator that shows the length of body / or total length of candle, plus the time of the candle bar.
Only thing is, it isn't suitable for 5 Digit brokers; time and length are projected over each other while perfect in Digit 4.
Would be very nice that somone is able and willing to change the code.
Thanks in advance,
Regards,
Ben
Missing something simple
I have been working on a TL filter for a MA cross EA, any MA cross EA but studding it on the attached as it is a simple one.
Basically the TL calculator gives signals 1, 2 or 3 depending TL direction and price cross and a nasty "zero divide" if the TL is not sloped enough.
I am learning coding and read all Coders’ Guru PDF's and as much as from MQL4 forum as my brain can take, but as I am slow learner and newer coded anything until 3 weeks ago....
Looking for some pointers....
Problem: I cant figure out how to call out the value "TLfilter" that is 3 when the price has not touched the TL and its OK to do a Buy.
I have attempted to stick it in the Buy / Sell criteria as &&TTLfilter = 3!, and any other methods i can figure out but but all i get then is no trades at all.
Also tried to get it into the OrderSelect loop but no luck.
Just looking for pointers as in what am i missing.
If someone is interested in having a look.
Draw a TL on the chart before attaching the EA and name it t6
Uncomment the //--- Print ("TLfilter = ",TLfilter); return(TLfilter); at the bottom of the TL section to see what it is doing.
Mod's to this EA are marked by double line ======= 1 2 and 3
Edit: None of my coding in this one, as wanted to make sure its as clean as possible
x_trader_v2_tlmod.mq4
multiindicator
Hi!
Somebody use/have a multiindicator like this?
Multi Moving Average - MQL4 Code Base
If you see down there, it look like "freedom bar" indicator... so... I want to change this input indicators, dont want to use 4ema.... I want 1ema( 2 crossing ), CCI, STOCH and SAR
I find some multiindicators, but they didn t have a history like this
can someone help and change code?
Hi Pearl1,
From what I can see it can be done you just need to enter the call replacing the other 3 moving averages with the indicators you want to use along with the conditions to signal.
I was try something, but no progress![](https://c.mql5.com/forextsd/smiles/frown.png)
Why don't you post what you coded so far and explain what are you trying to do. That way someone could help you
I was try something, but no progress
int start()
{
//----
int Counted.Bars = IndicatorCounted(), i;
if(Counted.Bars<0) return(-1);
if(Counted.Bars>0) Counted.Bars--;
int Limit = Bars - Counted.Bars;
color Text.Color.1, Text.Color.2, Text.Color.3, Text.Color.4;
//----
for(i=Limit; i>=0; i--)
{
MA0.Buffer.0 = iMA(NULL, 0, 1, 0, MODE_SMA, PRICE_MEDIAN, i); I suck here.... he always compare with this MA0.Buffer.0....so, if I use RSI, Stoch,... must create this buffer for all elements? RSI0.Buffer.0 for RSI?
//----
MA1.Buffer.0 = iMA(NULL, 0, MA1.Period, 0, MA1.Mode, MA1.Price, i);
MA1.Buffer.1 = iMA(NULL, 0, MA1.Period, 0, MA1.Mode, MA1.Price, i+1);
MA2.Buffer.0 = iMA(NULL, 0, MA2.Period, 0, MA2.Mode, MA2.Price, i);
MA2.Buffer.1 = iMA(NULL, 0, MA2.Period, 0, MA2.Mode, MA2.Price, i+1);
MA3.Buffer.0 = iMA(NULL, 0, MA3.Period, 0, MA3.Mode, MA3.Price, i);
MA3.Buffer.1 = iMA(NULL, 0, MA3.Period, 0, MA3.Mode, MA3.Price, i+1);
MA4.Buffer.0 = iMA(NULL, 0, MA4.Period, 0, MA4.Mode, MA4.Price, i);
MA4.Buffer.1 = iMA(NULL, 0, MA4.Period, 0, MA4.Mode, MA4.Price, i+1);
MA1.UP.Buffer = EMPTY_VALUE;
MA1.DN.Buffer = EMPTY_VALUE;
if(MA1.Buffer.0 < MA1.Buffer.1) MA1.DN.Buffer = Gap * P1.Position + 1.0;
else MA1.UP.Buffer = Gap * P1.Position + 1.0;
if(MA1.Buffer.0 < MA0.Buffer.0) Text.Color.1 = Text.Color.Up;
else Text.Color.1 = Text.Color.Down;
//----
MA2.UP.Buffer = EMPTY_VALUE;
MA2.DN.Buffer = EMPTY_VALUE;
if(MA2.Buffer.0 < MA2.Buffer.1) MA2.DN.Buffer = Gap * P2.Position + 1.0;
else MA2.UP.Buffer = Gap * P2.Position + 1.0;
if(MA2.Buffer.0 < MA0.Buffer.0) Text.Color.2 = Text.Color.Up;
else Text.Color.2 = Text.Color.Down;
//----
MA3.UP.Buffer = EMPTY_VALUE;
MA3.DN.Buffer = EMPTY_VALUE;
if(MA3.Buffer.0 < MA3.Buffer.1) MA3.DN.Buffer = Gap * P3.Position + 1.0;
else MA3.UP.Buffer = Gap * P3.Position + 1.0;
if(MA3.Buffer.0 < MA0.Buffer.0) Text.Color.3 = Text.Color.Up;
else Text.Color.3 = Text.Color.Down;
//----
MA4.UP.Buffer = EMPTY_VALUE;
MA4.DN.Buffer = EMPTY_VALUE;
if(MA4.Buffer.0 < MA4.Buffer.1) MA4.DN.Buffer = Gap * P4.Position + 1.0;
else MA4.UP.Buffer = Gap * P4.Position + 1.0;
if(MA4.Buffer.0 < MA0.Buffer.0) Text.Color.4 = Text.Color.Up;
else Text.Color.4 = Text.Color.Down;
//----
//----
LabelSet(Text.Color.1, Text.Color.2, Text.Color.3, Text.Color.4);
//----
}
//----
return(0);
You don't need to create buffer for all elements.
MA1.Buffer.0, MA1.Buffer.1, .... are not buffers but simple variables. You can use them for anything without changing their names. If you want to use it, for example, for rsi, you can change the code to something like this :
without the need to change the names of the variables and it will work (just define RSI1.Period and RSI1.Price in this case as external parameters)
int start()
{
//----
int Counted.Bars = IndicatorCounted(), i;
if(Counted.Bars<0) return(-1);
if(Counted.Bars>0) Counted.Bars--;
int Limit = Bars - Counted.Bars;
color Text.Color.1, Text.Color.2, Text.Color.3, Text.Color.4;
//----
for(i=Limit; i>=0; i--)
{
MA0.Buffer.0 = iMA(NULL, 0, 1, 0, MODE_SMA, PRICE_MEDIAN, i); I suck here.... he always compare with this MA0.Buffer.0....so, if I use RSI, Stoch,... must create this buffer for all elements? RSI0.Buffer.0 for RSI?
//----
MA1.Buffer.0 = iMA(NULL, 0, MA1.Period, 0, MA1.Mode, MA1.Price, i);
MA1.Buffer.1 = iMA(NULL, 0, MA1.Period, 0, MA1.Mode, MA1.Price, i+1);
MA2.Buffer.0 = iMA(NULL, 0, MA2.Period, 0, MA2.Mode, MA2.Price, i);
MA2.Buffer.1 = iMA(NULL, 0, MA2.Period, 0, MA2.Mode, MA2.Price, i+1);
MA3.Buffer.0 = iMA(NULL, 0, MA3.Period, 0, MA3.Mode, MA3.Price, i);
MA3.Buffer.1 = iMA(NULL, 0, MA3.Period, 0, MA3.Mode, MA3.Price, i+1);
MA4.Buffer.0 = iMA(NULL, 0, MA4.Period, 0, MA4.Mode, MA4.Price, i);
MA4.Buffer.1 = iMA(NULL, 0, MA4.Period, 0, MA4.Mode, MA4.Price, i+1);
MA1.UP.Buffer = EMPTY_VALUE;
MA1.DN.Buffer = EMPTY_VALUE;
if(MA1.Buffer.0 < MA1.Buffer.1) MA1.DN.Buffer = Gap * P1.Position + 1.0;
else MA1.UP.Buffer = Gap * P1.Position + 1.0;
if(MA1.Buffer.0 < MA0.Buffer.0) Text.Color.1 = Text.Color.Up;
else Text.Color.1 = Text.Color.Down;
//----
MA2.UP.Buffer = EMPTY_VALUE;
MA2.DN.Buffer = EMPTY_VALUE;
if(MA2.Buffer.0 < MA2.Buffer.1) MA2.DN.Buffer = Gap * P2.Position + 1.0;
else MA2.UP.Buffer = Gap * P2.Position + 1.0;
if(MA2.Buffer.0 < MA0.Buffer.0) Text.Color.2 = Text.Color.Up;
else Text.Color.2 = Text.Color.Down;
//----
MA3.UP.Buffer = EMPTY_VALUE;
MA3.DN.Buffer = EMPTY_VALUE;
if(MA3.Buffer.0 < MA3.Buffer.1) MA3.DN.Buffer = Gap * P3.Position + 1.0;
else MA3.UP.Buffer = Gap * P3.Position + 1.0;
if(MA3.Buffer.0 < MA0.Buffer.0) Text.Color.3 = Text.Color.Up;
else Text.Color.3 = Text.Color.Down;
//----
MA4.UP.Buffer = EMPTY_VALUE;
MA4.DN.Buffer = EMPTY_VALUE;
if(MA4.Buffer.0 < MA4.Buffer.1) MA4.DN.Buffer = Gap * P4.Position + 1.0;
else MA4.UP.Buffer = Gap * P4.Position + 1.0;
if(MA4.Buffer.0 < MA0.Buffer.0) Text.Color.4 = Text.Color.Up;
else Text.Color.4 = Text.Color.Down;
//----
//----
LabelSet(Text.Color.1, Text.Color.2, Text.Color.3, Text.Color.4);
//----
}
//----
return(0);int start()
{
//----
int Counted.Bars = IndicatorCounted(), i;
if(Counted.Bars<0) return(-1);
if(Counted.Bars>0) Counted.Bars--;
int Limit = Bars - Counted.Bars;
color Text.Color.1, Text.Color.2, Text.Color.3, Text.Color.4;
//----
for(i=Limit; i>=0; i--)
{
MA0.Buffer.0 = iMA(NULL, 0, 1, 0, MODE_SMA, PRICE_MEDIAN, i);
//----
MA1.Buffer.0 = iMA(NULL, 0, MA1.Period, 0, MA1.Mode, MA1.Price, i);
MA1.Buffer.1 = iMA(NULL, 0, MA1.Period, 0, MA1.Mode, MA1.Price, i+1);
MA2.Buffer.0 = iMA(NULL, 0, MA2.Period, 0, MA2.Mode, MA2.Price, i);
MA2.Buffer.1 = iMA(NULL, 0, MA2.Period, 0, MA2.Mode, MA2.Price, i+1);
MA3.Buffer.0 = iMA(NULL, 0, MA3.Period, 0, MA3.Mode, MA3.Price, i);
MA3.Buffer.1 = iMA(NULL, 0, MA3.Period, 0, MA3.Mode, MA3.Price, i+1);
MA4.Buffer.0 = iMA(NULL, 0, MA4.Period, 0, MA4.Mode, MA4.Price, i);
MA4.Buffer.1 = iMA(NULL, 0, MA4.Period, 0, MA4.Mode, MA4.Price, i+1);
MA1.UP.Buffer = EMPTY_VALUE;
MA1.DN.Buffer = EMPTY_VALUE;
if(MA1.Buffer.0 < MA1.Buffer.1) MA1.DN.Buffer = Gap * P1.Position + 1.0;
else MA1.UP.Buffer = Gap * P1.Position + 1.0;
if(MA1.Buffer.0 < MA0.Buffer.0) Text.Color.1 = Text.Color.Up;
else Text.Color.1 = Text.Color.Down;
//----
MA2.UP.Buffer = EMPTY_VALUE;
MA2.DN.Buffer = EMPTY_VALUE;
if(MA2.Buffer.0 < MA2.Buffer.1) MA2.DN.Buffer = Gap * P2.Position + 1.0;
else MA2.UP.Buffer = Gap * P2.Position + 1.0;
if(MA2.Buffer.0 < MA0.Buffer.0) Text.Color.2 = Text.Color.Up;
else Text.Color.2 = Text.Color.Down;
//----
MA3.UP.Buffer = EMPTY_VALUE;
MA3.DN.Buffer = EMPTY_VALUE;
if(MA3.Buffer.0 < MA3.Buffer.1) MA3.DN.Buffer = Gap * P3.Position + 1.0;
else MA3.UP.Buffer = Gap * P3.Position + 1.0;
if(MA3.Buffer.0 < MA0.Buffer.0) Text.Color.3 = Text.Color.Up;
else Text.Color.3 = Text.Color.Down;
//----
MA4.UP.Buffer = EMPTY_VALUE;
MA4.DN.Buffer = EMPTY_VALUE;
if(MA4.Buffer.0 < MA4.Buffer.1) MA4.DN.Buffer = Gap * P4.Position + 1.0;
else MA4.UP.Buffer = Gap * P4.Position + 1.0;
if(MA4.Buffer.0 < MA0.Buffer.0) Text.Color.4 = Text.Color.Up;
else Text.Color.4 = Text.Color.Down;
//----
//----
LabelSet(Text.Color.1, Text.Color.2, Text.Color.3, Text.Color.4);
//----
}
//----
return(0);aha, thanks, but this Buffers compares .... all with MA0.Buffer.0 ?
Just replace the IMA() calls with the calls you want (like the iRSI() from the example I gave you) and they should work, No need to replace variable names
aha, thanks, but this Buffers compares .... all with MA0.Buffer.0 ?