
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
this poor soul needs your help
Ok. I have added back the close conditions part(attached). The errors that appear when the original is compiled is the same as my adjusted. Now back to the original questions: have i managed to write the code in such a way as to fullfil the conditions i set when i first posted when i started my request on this. WHich is buy on RSI 6 Stoch 16.3.3 EMA 5 above ema50 level above 70 and sell when
rsi 6 stoch16.3.3 ema5below ema50 level below 30. also could you interpret the close conditions for me. what i did to correct file was open the files in meta editor and then made the screen show one side one file and other file , in tile fashion, next to it and just went line by line to see which lines were missing or different. I can not code but i can try decipher what someone has done and by commonsense change a thing or two. you are a star mladen
Ok. I have added back the close conditions part(attached). The errors that appear when the original is compiled is the same as my adjusted. Now back to the original questions: have i managed to write the code in such a way as to fullfil the conditions i set when i first posted when i started my request on this. WHich is buy on RSI 6 Stoch 16.3.3 EMA 5 above ema50 level above 70 and sell when rsi 6 stoch16.3.3 ema5below ema50 level below 30. also could you interpret the close conditions for me. what i did to correct file was open the files in meta editor and then made the screen show one side one file and other file , in tile fashion, next to it and just went line by line to see which lines were missing or different. I can not code but i can try decipher what someone has done and by commonsense change a thing or two. you are a star mladen
candyman752
Test the EA. Those are compiler warnings, not errors. Regardless of those warnings the EA should work
candyman752 Test the EA. Those are compiler warnings, not errors. Regardless of those warnings the EA should work
i take it your silence on confirming is confirmation that i have managed to code it to do the following:RSI 6 stoch 16-3-3 / 5EMA 50EMA.over bought level 70 oversold level 30. It should buy when 5ema moves above 50 ema and rsi and stoch are above 70 and should sell when 5 ema is below 50ema and rsi and stoch are below 30.
Hello madlen, let me put my request another way
in the original EA the conditions for buy or sell was
if(EMA5aEMA10&&RSI1>RSILevel&&STOS<STOM&&STOS<Overbought&&STOM<Overbought)SBUY="true";
if(EMA5a>EMA10a&&EMA5<EMA10&&RSI1STOM&&STOS>Oversold&&STOM>Oversold)SSEL="true";
I then changed the code as follows:
if(EMA5aEMA50&&RSI1>RSILevelb&&STOSOverbought&&STOM>Overbought)SBUY="true";
if(EMA5a>EMA50a&&EMA5<EMA50&&RSI1STOM&&STOS<Oversold&&STOM<Oversold)SSEL="true";
RSI levelb=70 RSI levels=30 overbought=70 oversold=30.
Does the change i made to the code match the conditions i stated earlier. buy when 5ema is above 5ema rsi above 70 stochastic above 70 and vice versa
i take it your silence on confirming is confirmation that i have managed to code it to do the following:RSI 6 stoch 16-3-3 / 5EMA 50EMA.over bought level 70 oversold level 30. It should buy when 5ema moves above 50 ema and rsi and stoch are above 70 and should sell when 5 ema is below 50ema and rsi and stoch are below 30.
candyman752
What I told is that the list hat the compiler shows after compilation is containing only warning that are not affecting the execution of the EA (any EA). I did not check the logic nor did I test the EA. That is why I told that you have to test it.
As far as code is concerned, it will work. It is up to your work to fine tune it and adjust where it needs adjustment
happy coding
Coders,
I'm experiencing some problems with the following code.
For a long time I'm using 2 indicator as filter. They display trend in a histogram in the second window.
I tried to create an third indicator who combines both indicators in one histogram.
Unfortunately it doesn't work, I've called both indicators with the iCustom function and I use the right buffer. But the histogram keeps blank.
To find the problem I have replaced the iCustom functions with a iMA function. At that moment the code worked and the histogram showed the right colors
. So it has something to do with the iCustom functions or the if statements.
I hope someone could help me out.
Thanks in advance
#property version "1.00"
#property strict
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 LimeGreen
#property indicator_color2 Red
#property indicator_width1 3
#property indicator_width2 3
#property indicator_minimum 0
#property indicator_maximum 1
double Groen[];
double Rood[];
double zibo1g[],zibo1r[],zibo2g[],zibo2r[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
SetIndexBuffer(0,Groen);
SetIndexStyle(0,DRAW_HISTOGRAM);
SetIndexLabel(0,"Groen");
SetIndexBuffer(1,Rood);
SetIndexStyle(1,DRAW_HISTOGRAM);
SetIndexLabel(1,"Rood");
IndicatorShortName("Zibo Combo");
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,const int prev_calculated,const datetime &time[],const double &open[],const double &high[],const double &low[],const double &close[],const long &tick_volume[],const long &volume[],const int &spread[])
{
int counted_bars=IndicatorCounted();
int limit=Bars-counted_bars;
double dResult = 1;
for(int i=0; i<limit; i++){
zibo1g=iCustom(NULL,0,"zibo1",0,i); //green histogram
zibo1r=iCustom(NULL,0,"zibo1",1,i); //red histogram
zibo2g=iCustom(NULL,0,"zibo2",0,i); //green histogram
zibo2r=iCustom(NULL,0,"zibo2",1,i); //red histogram
if(zibo1g != EMPTY_VALUE && zibo2g != EMPTY_VALUE)
Groen = dResult;
else if(zibo1r != EMPTY_VALUE && zibo2r != EMPTY_VALUE)
Rood = dResult;
}
return(rates_total);
}m1-red.mq4
Hello to all. I need help fixing fix this indicator .. in practice need to add a (20-period MA) with the same function as the existing one, and eliminate eliminate color boxes, not used
I always ask pardon for my bad English
Coders,
I'm experiencing some problems with the following code.
For a long time I'm using 2 indicator as filter. They display trend in a histogram in the second window.
I tried to create an third indicator who combines both indicators in one histogram.
Unfortunately it doesn't work, I've called both indicators with the iCustom function and I use the right buffer. But the histogram keeps blank.
To find the problem I have replaced the iCustom functions with a iMA function. At that moment the code worked and the histogram showed the right colors
. So it has something to do with the iCustom functions or the if statements.
I hope someone could help me out.
Thanks in advance
#property version "1.00"
#property strict
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 LimeGreen
#property indicator_color2 Red
#property indicator_width1 3
#property indicator_width2 3
#property indicator_minimum 0
#property indicator_maximum 1
double Groen[];
double Rood[];
double zibo1g[],zibo1r[],zibo2g[],zibo2r[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
SetIndexBuffer(0,Groen);
SetIndexStyle(0,DRAW_HISTOGRAM);
SetIndexLabel(0,"Groen");
SetIndexBuffer(1,Rood);
SetIndexStyle(1,DRAW_HISTOGRAM);
SetIndexLabel(1,"Rood");
IndicatorShortName("Zibo Combo");
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,const int prev_calculated,const datetime &time[],const double &open[],const double &high[],const double &low[],const double &close[],const long &tick_volume[],const long &volume[],const int &spread[])
{
int counted_bars=IndicatorCounted();
int limit=Bars-counted_bars;
double dResult = 1;
for(int i=0; i<limit; i++){
zibo1g=iCustom(NULL,0,"zibo1",0,i); //green histogram
zibo1r=iCustom(NULL,0,"zibo1",1,i); //red histogram
zibo2g=iCustom(NULL,0,"zibo2",0,i); //green histogram
zibo2r=iCustom(NULL,0,"zibo2",1,i); //red histogram
if(zibo1g != EMPTY_VALUE && zibo2g != EMPTY_VALUE)
Groen = dResult;
else if(zibo1r != EMPTY_VALUE && zibo2r != EMPTY_VALUE)
Rood = dResult;
}
return(rates_total);
}Your zibo1g[],zibo1r[],zibo2g[] and zibo2r[] arrays are always zero size arrays (they are never initialized - resized to bar elements)
Best that you declare them as additional buffers if you are not familiar how to work with arrays in mql
m1-red.mq4
Hello to all. I need help fixing fix this indicator .. in practice need to add a (20-period MA) with the same function as the existing one, and eliminate eliminate color boxes, not used
I always ask pardon for my bad EnglishThere are no color boxes in the one you attached. Anyway try this : m1-red_1.mq4
Thanks Mladen to be always available.
in the previous post I was wondering if it was possible to add another MA of 20 periods with the same formula