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
Singular spectrum analysis (SSA) recalculates unless it is an end-point version. Since that indicator uses "regular" SSA, it recalculates too
I am afraid that from the code I can not see what is your intention at all
If you are trying to have averages with levels, use the one that I posted as a template
Hi,
yes I will use your advanced ma with levels, (it's has more prices, etc.. colored ma, etc..)
but I tried to create one by my self to understand how to create a custom indicators,
my idea is to create the same component (basically a MA with 2 levels..)
I use a central MA , and another 2 MA plotted using dots lines to gave the same effect as levels...
for each level I populate the buffer using on calculate event... like you told me, but something is wrong ;-(
the 2 MAs that simulate level will be shifted vertically... but it's not working
Hi,
yes I will use your advanced ma with levels, (it's has more prices, etc.. colored ma, etc..)
but I tried to create one by my self to understand how to create a custom indicators,
my idea is to create the same component (basically a MA with 2 levels..)
I use a central MA , and another 2 MA plotted using dots lines to gave the same effect as levels...
for each level I populate the buffer using on calculate event... like you told me, but something is wrong ;-(
the 2 MAs that simulate level will be shifted vertically... but it's not working
Yes, that is what I meant
The thing is as simple as it gets :
There is no need to change anything in averages calculation or anything else : just a simple addition or subtraction from the central (ma) buffer
double pipLevel1 = -10;
double pipLevel2 = 10;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
void OnInit()
{
//--- indicator buffers mapping
SetIndexBuffer(0,ExtLineBuffer,INDICATOR_DATA); //MA Buffer
SetIndexBuffer(1,ExtLv1Buffer,INDICATOR_DATA); //MA lv1 Buffer
SetIndexBuffer(2,ExtLv2Buffer,INDICATOR_DATA); //MA lv2 Buffer
//--- set accuracy
IndicatorSetInteger(INDICATOR_DIGITS,_Digits+1);
//--- sets first bar from what index will be drawn
PlotIndexSetInteger(0,PLOT_LINE_STYLE,STYLE_SOLID); //MA Style
PlotIndexSetInteger(1,PLOT_LINE_STYLE,STYLE_DOT); //MA lvl1 Style
PlotIndexSetInteger(2,PLOT_LINE_STYLE,STYLE_DOT); //MA lvl2 Style
//IndicatorSetInteger(INDICATOR_LEVELS,1,InpLevel1); //MA lvl1 Value
//IndicatorSetInteger(INDICATOR_COLOR2,1,Cyan);
//IndicatorSetInteger(INDICATOR_STYLE2,1,STYLE_DOT);
//IndicatorSetInteger(INDICATOR_IDTH,1,1);
//IndicatorSetInteger(INDICATOR_LEVELS,2,InpLevel2); //MA lvl2 Value
//IndicatorSetInteger(INDICATOR_LEVELCOLOR,2,Cyan);
//IndicatorSetInteger(INDICATOR_LEVELSTYLE,2,STYLE_DOT);
//IndicatorSetInteger(INDICATOR_LEVELWIDTH,2,1);
PlotIndexSetInteger(0,PLOT_DRAW_BEGIN,InpMAPeriod); //MA
PlotIndexSetInteger(1,PLOT_DRAW_BEGIN,InpMAPeriod); //MA lvl1
PlotIndexSetInteger(2,PLOT_DRAW_BEGIN,InpMAPeriod); //MA lvl2
//---- line shifts when drawing
PlotIndexSetInteger(0,PLOT_SHIFT,InpMAShift); //MA
PlotIndexSetInteger(1,PLOT_SHIFT,InpMAShift); //MA lvl1
PlotIndexSetInteger(2,PLOT_SHIFT,InpMAShift); //MA lvl2
//--- name for DataWindow
string short_name="unknown ma";
switch(InpMAMethod)
{
case MODE_EMA : short_name="EMA"; break;
case MODE_LWMA : short_name="LWMA"; break;
case MODE_SMA : short_name="SMA"; break;
case MODE_SMMA : short_name="SMMA"; break;
}
IndicatorSetString(INDICATOR_SHORTNAME,short_name+"("+string(InpMAPeriod)+")");
//---- sets drawing line empty value--
PlotIndexSetDouble(0,PLOT_EMPTY_VALUE,0.0); //MA
PlotIndexSetDouble(1,PLOT_EMPTY_VALUE,0.0); //MA lvl1
PlotIndexSetDouble(2,PLOT_EMPTY_VALUE,0.0); //MA lvl2
//---- initialization done
}
//+------------------------------------------------------------------+
//| Moving Average |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
const int prev_calculated,
const int begin,
const double &price[])
{
double pipMultiplier=_Point*MathPow(10,MathMod(_Digits,2));
pipLevel1 = InpLevel1 * pipMultiplier;
pipLevel2 = InpLevel2 * pipMultiplier;
//Print("point:"+_Point+" Digits:"+_Digits+ "pipMul:"+pipMultiplier);
//pipLevel1 = InpLevel1 / 10;
//pipLevel2 = InpLevel2 / 10;
//--- check for bars count
if(rates_total<InpMAPeriod-1+begin)
return(0);// not enough bars for calculation
//--- first calculation or number of bars was changed
if(prev_calculated==0)
{
ArrayInitialize(ExtLineBuffer,0); //MA
ArrayInitialize(ExtLv1Buffer,1); //MA level1
ArrayInitialize(ExtLv2Buffer,2); //MA level2
}
//--- sets first bar from what index will be draw
PlotIndexSetInteger(0,PLOT_DRAW_BEGIN,InpMAPeriod-1+begin); //MA
PlotIndexSetInteger(1,PLOT_DRAW_BEGIN,InpMAPeriod-1+begin); //MA lvl1
PlotIndexSetInteger(2,PLOT_DRAW_BEGIN,InpMAPeriod-1+begin); //MA lvl2
//--- calculation
switch(InpMAMethod)
{
case MODE_EMA:
CalculateEMA(rates_total,prev_calculated,begin,price);
ExtLv1Buffer[rates_total-1]=price[rates_total-1]+pipLevel1;
ExtLv2Buffer[rates_total-1]=price[rates_total-1]+pipLevel2;
//Print ("rates_total:"+rates_total+" prev:"+prev_calculated+" begin:"+begin+" price:"+price[rates_total-1]);
break;
case MODE_LWMA:
CalculateLWMA(rates_total,prev_calculated,begin,price);
ExtLv1Buffer[rates_total-1]=price[rates_total-1]+pipLevel1;
ExtLv2Buffer[rates_total-1]=price[rates_total-1]+pipLevel2;
break;
case MODE_SMMA:
CalculateSmoothedMA(rates_total,prev_calculated,begin,price);
ExtLv1Buffer[rates_total-1]=price[rates_total-1]+pipLevel1;
ExtLv2Buffer[rates_total-1]=price[rates_total-1]+pipLevel2;
break;
case MODE_SMA:
CalculateSimpleMA(rates_total,prev_calculated,begin,price);
ExtLv1Buffer[rates_total-1]=price[rates_total-1]+pipLevel1;
ExtLv2Buffer[rates_total-1]=price[rates_total-1]+pipLevel2;
break;
}
//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+
Yes, that is what I meant
The thing is as simple as it gets :
There is no need to change anything in averages calculation or anything else : just a simple addition or subtraction from the central (ma) buffer
could you show a sample code for add/subtract (vertically) the ma? I tried but my code fails..
could you show a sample code for add/subtract (vertically) the ma? I tried but my code fails..
That indicator uses centered TMA - it recalculates. Alerts would be pointless
ok what of arrow when the color change
ok what of arrow when the color change
The signals (arrows) would be pointless due to its recalculating/repainting nature
Dear @mladen,
Can an expert that does not have Ecn support be used with an Ecn type broker without a problem?
In some experts there are options for Ecn type brokers.
This led me think that it could be better to optimize or add some codes for Ecn type brokers.
Dear @mladen,
Can an expert that does not have Ecn support be used with an Ecn type broker without a problem?
In some experts there are options for Ecn type brokers.
This led me think that it could be better to optimize or add some codes for Ecn type brokers.
Yes, if you do not use stop loss and take profit when opening orders
If it is made for ecn/stp on the other side, it will work on any broker with no problem at all. The only difference is at the moment of opening orders - no other change (or optimization) is needed at all
Thank you for detailed your answer.
As far as I know the attached ea does not have Ecn type broker support.
I want to use this ea in Ecn type broker by using SL and TP.
I will be very happy if you provide Ecn type broker support.
That ea would need a rewrite so that everybody understands it
But since I do not speak the language used in it, I can not help. Sorry