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
Hi Mladen,
thank you very much for your idea. I had a look in the code of the EA.
As far as I understand, the xpMA indicator which is included via "iCustom"
either return a "1" or "-1" signal which triggers the BUY or SELL condition in the EA.
But for some reason it is not opening a single trade in MT4. I am not an expert as I am new into MQL4 coding. Debugging seems to be relatively difficult as I am not able to set "break points" in the MQL4 editor, so I am not able to see whether the indicator really delivers the signal after its colour / trend has changed.
Could you probably help me with your expertise?
Thank you in advance.
With kind regards,
T.tfi_markets
Yes, the iCustom() will return values a and -1 when 4th buffer is referenced in the iCustom() call. But if you use 1st buffer (it would be 0 in the iCustom() parameters call) then you can retriev the values of the ma itself and check if a change in slope direction happened
Hi Mladen,
if I understood you correctly I need to call the 4th indicator buffer to get the "1" or "-1" signals to open BUY or SELL orders. Maybe the code line below would do the job because "0" represents the 1st buffer?
Thank you in advance.
With kind regards,
T.
Hi Mladen,
if I understood you correctly I need to call the 4th indicator buffer to get the "1" or "-1" signals to open BUY or SELL orders. Maybe the code line below would do the job because "0" represents the 1st buffer?
Thank you in advance.
With kind regards,
T.You can try something like this to check if there is a change in slope direction (penultimate parameter in iCustom() call is the number of the buffer) :
double value2 = iCustom(NULL,0,"xpMA",MA_Period,MA_Type,MA_Applied ,T3MA_VolumeFactor,JMA_Phase,Step_Period,BarsCount,Alert_On,Arrows_On,Email_On,0,2);
double value3 = iCustom(NULL,0,"xpMA",MA_Period,MA_Type,MA_Applied ,T3MA_VolumeFactor,JMA_Phase,Step_Period,BarsCount,Alert_On,Arrows_On,Email_On,0,3);
if ((value1-value2)*(value2-value3)<0)
if (value1>value2)
slope changed to up
else slope changed to down
I think that this is the best way to check it because this way you do not depened on anything else but the values of the average and no repainting can cause you to have a false signal
Hi Mladen,
I have implemented the code idea you had. I am not sure if I did it correct, the code looks now like this.
double signal_1 = iCustom(NULL,0,"xpMA",MA_Period,MA_Type,MA_Applied ,T3MA_VolumeFactor,JMA_Phase,Step_Period,BarsCount,Alert_On,Arrows_On,Email_On,0,1);
double signal_2 = iCustom(NULL,0,"xpMA",MA_Period,MA_Type,MA_Applied ,T3MA_VolumeFactor,JMA_Phase,Step_Period,BarsCount,Alert_On,Arrows_On,Email_On,0,2);
double signal_3 = iCustom(NULL,0,"xpMA",MA_Period,MA_Type,MA_Applied ,T3MA_VolumeFactor,JMA_Phase,Step_Period,BarsCount,Alert_On,Arrows_On,Email_On,0,3);
bool BuyCondition = false , SellCondition = false , CloseBuyCondition = false , CloseSellCondition = false;
if ((signal_1-signal_2)*(signal_2-signal_3)<0)
if (signal_1>signal_2)
BuyCondition = true;
if (BuyCondition)
CloseSellCondition = true;
else
if (signal_1==-1)
SellCondition = true;
if (SellCondition)
CloseBuyCondition = true;
if(UseMoneyManagement)
Lots=NormalizeDouble(AccountFreeMargin()*MaximumRisk/1000.0,1);
if(TradeExist(MagicNumber)==false)
{
int ticket;
if(BuyCondition) //<-- BUY condition
{
if(NewBar(0))
ticket = OpenOrder(true,OP_BUY,0,Lots,Slippage,StopLoss,TakeProfit,MagicNumber,WindowExpertName(),5,500);
}
if(SellCondition) //<-- SELL condition
{
if(NewBar(1))
ticket = OpenOrder(true,OP_SELL,0,Lots,Slippage,StopLoss,TakeProfit,MagicNumber,WindowExpertName(),5,500);
}
}
Unfortunately it is still not open a trade after a signal change took place. In the data window of MT4 I am able to see that it is creating "Signal = 1 or Signal = -1" on trend change, so actually the original version should have worked somehow as well.
Thank you again for helping.
With kind regards,
T.
Hello Mladen
I really like the Xpma v11sw Ea you modified for separate window install but I noticed that the time shift was missing can this be put back in . I tried but messed the whole thing up. Sorry ,Im not sure how to attach the file
Thanks
Mjack59
What are the Logic used in this Indicator for Buy/Sell?
Hello,
I am trying to use Codersguru's 'xpMA' indicator into EA. So for it I have to call it by using iCustom.
I have defined the first three buffers of that indicator but now not understanding how that indi is producing the 'Buy/Sell' arrows (Signal). I want to use the same Conditions/Logic.
double Buf_1 = iCustom(NULL,0,"xpMA",MA_Period,MA_Type,MA_Applied ,T3MA_VolumeFactor,JMA_Phase,Step_Period,DebugMode,0,1);
double Buf_2 = iCustom(NULL,0,"xpMA",MA_Period,MA_Type,MA_Applied ,T3MA_VolumeFactor,JMA_Phase,Step_Period,DebugMode,0,2);Any kind Help will be greatly appreciated.
Thanks
Hello,
I am trying to use Codersguru's 'xpMA' indicator into EA. So for it I have to call it by using iCustom.
I have defined the first three buffers of that indicator but now not understanding how that indi is producing the 'Buy/Sell' arrows (Signal). I want to use the same Conditions/Logic.
double Buf_1 = iCustom(NULL,0,"xpMA",MA_Period,MA_Type,MA_Applied ,T3MA_VolumeFactor,JMA_Phase,Step_Period,DebugMode,0,1);
double Buf_2 = iCustom(NULL,0,"xpMA",MA_Period,MA_Type,MA_Applied ,T3MA_VolumeFactor,JMA_Phase,Step_Period,DebugMode,0,2);Any kind Help will be greatly appreciated.
ThanksOridroo
If the value of the current bar is greater or smaller than the Step_Period simple moving average of previous values then the arrow is drawn
Isn't xpMA repainting?
Isn't xpMA repainting?
Colors yes - sometimes, but not those arrows
Colors yes - sometimes, but not those arrows
Ah, OK. Thanks