Good afternoon, (scuse for my english, is not my language)
I would want to know if it's possible to buy/sell a pairB from an EA whose is plot on a graph of a pairA.
I write an pair trading EA and I haven't error during compliation, however when I test it, the EA buy/sell only pairA and never pairB and I have an error 4106 (unknow symbol).
Thank's for your answer:
if(SpreadPrev<BollSupPrev && Spread>BollSup && TradeOk==1)
{
nb_contrats=0.1;
resA=OrderSend(InstrA,OP_BUY,nb_contrats,Ask,3,0,0,"",MAGICMA,0,Yellow);
EquityTotale=0;//je la remet a 0 afin que le calcul du coef soit fait a nouveau
msg="Long "+InstrA+" "+TimeToStr(TimeCurrent(),TIME_DATE)+" "+TimeToStr(TimeCurrent(),TIME_SECONDS)+" "+NormalizeDouble(nb_contrats,2)+" a "+Ask+" "+coefMultiplicateur;
if(resA==-1)
{
WriteLog("Erreur","OrderSend","EA_CointBoll Long "+InstrA,nb_contrats,Ask,GetLastError(),coefMultiplicateur);
msg=msg+"Envoi Long: "+InstrA+","+GetLastError()+" Coef: "+coefMultiplicateur;
}
else if(resA>=0)
{
WriteLog("Trade","OrderSend","EA_CointBoll long "+InstrA,NormalizeDouble(nb_contrats,2),Ask,0,coefMultiplicateur);
msg=msg+"Envoi ok "+InstrA;
}
resB=OrderSend(InstrB,OP_SELL,nb_contrats,Bid,3,0,0,"",MAGICMA2,0,Yellow); //I try with the same magin and I had the same problem
msg=msg+"<br/>Short "+InstrB+" "+TimeToStr(TimeCurrent(),TIME_DATE)+" "+TimeToStr(TimeCurrent(),TIME_SECONDS)+" "+NormalizeDouble(nb_contrats,2)+" a "+Ask+" "+coefMultiplicateur;
if(resB==-1)
{
WriteLog("Erreur","OrderSend","EA_CointBoll Short "+InstrB,nb_contrats,Bid,GetLastError(),coefMultiplicateur);
msg=msg+"Envoi Short: "+InstrB+","+GetLastError()+" Coef: "+coefMultiplicateur;
}
else if(resB>=0)
{
WriteLog("Trade","OrderSend","EA_CointBoll Short "+InstrB,NormalizeDouble(nb_contrats,2),Bid,0,coefMultiplicateur);
msg=msg+"Envoi ok "+InstrB;
}
SendMail("EA_CointBoll LASB"+InstrA+"-"+InstrB,msg);
}
Play videoPlease edit your post.
For large amounts of code, attach it.
resB=OrderSend(InstrB,OP_SELL,nb_contrats,Bid,3,0,0,"",MAGICMA...
You are asking about trading InstrB. But Bid is the charts price not InstrB.msg=msg+"<br/>Short "+InstrB +" "+TimeToStr(TimeCurrent(),TIME_DATE)+" "+TimeToStr(TimeCurrent(),TIME_SECONDS) +" "+NormalizeDouble(nb_contrats,2)+" a "+Ask+" "+coefMultiplicateur; if(resB==-1) { WriteLog("Erreur","OrderSend","EA_CointBoll Short "+InstrB,nb_contrats, Bid,GetLastError(),coefMultiplicateur);
Test for the error and capture GetLastError immediately. Lines in between can invalidate your GLE.- buy/sell a pairB from an EA whose is plot on a graph of a pairA.Yes, but you can't use Bid/Ask/Digits, etc. Don't do it, code the EA to select only its magic number and pair and just put it on multiple charts. Don't needlessly complicate things.
Thank's,
of course I understand, however, how can I do to have OHLC of pairB please? I looked your link, but I didn't understand.
Thank's a lot.
Thank's,
of course I understand, however, how can I do to have OHLC of pairB please? I looked your link, but I didn't understand.
Thank's so much,
I re write my code with you explanation, but now I have an error 4059, and this error is "function not allowed" in testing mode.
Is it impossible to test a pair tradin strategy?
And please, is my code good or must I change another thing?
Thank's.
if(SpreadPrev<BollSupPrev && Spread>BollSup && TradeOk==1)Thank's so much,
I re write my code with you explanation, but now I have an error 4059, and this error is "function not allowed" in testing mode.
Is it impossible to test a pair tradin strategy?
And please, is my code good or must I change another thing?
<CODE DELETED>
Please edit your post . . . please use the SRC button to post code: How to use the SRC button.
This should help: Testing Features and Limits in MetaTrader 4
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Good afternoon, (scuse for my english, is not my language)
I would want to know if it's possible to buy/sell a pairB from an EA whose is plot on a graph of a pairA.
I write an pair trading EA and I haven't error during compliation, however when I test it, the EA buy/sell only pairA and never pairB and I have an error 4106 (unknow symbol).
Is it possible to do this please? and if yes, could you exlain me how I can do this please?
Thank's a lot for your answer and your time.