This forum is in read-only mode now. You may discuss your questions on forums of MQL4.community and MQL5.community
DictionaryBack to topics list |
|
Stevenson
2005.07.02 13:08
Hello,
I have pasted below a simple code for trading multiple pairs using symbol function . And something is wrong there when opening trade. I had lost of excemples of experts advisors with symbol function, but due to lost some of files and data, i don't have it anymore. Many someone just could paste templet of their own. About two weeks i was trying , and still no good results. I would extreamly be thankfull for any help. Thank You. //shift
/*[[
Name := nb
Author :=
Link :=
Notes :=
Lots := 1
Stop Loss := 100
Take Profit := 100
Trailing Stop := 0
]]*/
Defines:risk(5),ff(2), cl(3),vl(6),cnt(0);
var: histo2(0),lotsi(0),slippage(0),i(0),H2(0),;
lotsi=Ceil((Balance*risk*PriceAsk)/100000);
histo2=iMAEx(cl,MODE_EMA,0,PRICE_OPEN,0)-iMAEx(vl,MODE_EMA,0,PRICE_OPEN,0);
H2=histo2/point;
for cnt=1 to TotalTrades
{
If Symbol = OrderValue(cnt,VAL_SYMBOL) then {
if H2<-ff then {
for i=1 to TotalTrades {
if ord(i,VAL_TYPE)=OP_SELL then
CloseOrder(ord(i,VAL_TICKET),ord(i,VAL_LOTS),ask,slippage,FireBrick)
else if ord(i,VAL_TYPE)=OP_SELLSTOP then
DeleteOrder(ord(i,VAL_TICKET),red);
};
if TotalTrades<1 then {
SetOrder(OP_BUY,lotsi,ask,Slippage,ask-StopLoss*point,ask+TakeProfit*Point,SkyBlue);
};
};
if H2>ff then {
for i=1 to TotalTrades {
if ord(i,VAL_TYPE)=OP_BUY then
CloseOrder(ord(i,VAL_TICKET),ord(i,VAL_LOTS),bid,slippage,Gray)
else if ord(i,VAL_TYPE)=OP_BUYSTOP then
DeleteOrder(ord(i,VAL_TICKET),red);
};
if TotalTrades<1 then {
SetOrder(OP_SELL,lotsi,bid,Slippage,bid+StopLoss*point,bid-TakeProfit*Point,white);
};
};
};};
|
|
tonyc2a
2005.07.02 16:10
Yes, this would be a big help. The little things are so nice and make a world of difference.
|
Download MetaTrader 5 (450 Kb, web installer) — a new terminal for financial markets
