[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 171
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 all, I wrote an EA! In the tester, everything works, but in the real account, it refuses to open positions! Note that he closes manually opened positions very well, but, precisely to open, does not want to ... What to do?
CODE:
//+------------------------------------------------------------------+//| DOKTRADE.mq4 |
//| DOKSTER@YANDEX.RU |
//| DOKSTER@YANDEX.RU |
//+------------------------------------------------------------------+
#property copyright "DOKSTER@YANDEX.RU"
#property link "DOKSTER@YANDEX.RU"
extern double LOT = 0.01; // LOTS
extern double KOF = 2;
extern double SAF = 5;
extern int FRC = 21;
int start()
{
int CNT;
int TOTAL;
int SPREAD;
double SPR;
double SPRW;
double FRCU;
double FRCU; double FRCD;
double EMAH;
double EMAM;;
double EMAL; double EMAL;
double OPEN;
double CLOSE;
double DFB;
double DFS;
EMAH = iMA(NULL,0,34,8,MODE_SMA,PRICE_HIGH,1);
EMAM = iMA(NULL,0,34,8,MODE_SMA,PRICE_MEDIAN,1);
EMAL = iMA(NULL,0,34,8,MODE_SMA,PRICE_LOW,1);
OPEN = iOpen(NULL,0,1);
CLOSE = iClose(NULL,0,1);
FRCU = High[iHighest(NULL,0,MODE_HIGH,FRC,1)];
FRCD = Low[iLowest(NULL,0,MODE_LOW,FRC,1)];
DFB = (CLOSE-FRCD);
DFS = (FRCU-CLOSE);
SPR = MarketInfo(Symbol(),MODE_SPREAD);
SPRW = (SPR*Point);
TOTAL = OrdersTotal();
if(TOTAL<1)
{
{ if (OPEN<EMAH&&CLOSE>EMAH)
OrderSend(Symbol(),OP_BUY,LOT,Ask,3,FRCD-(SAF*Point),CLOSE+(DFB*KOF), "DOKTRADE",15775,0,Green);
if (OPEN>EMAL&&CLOSE<EMAL)
OrderSend(Symbol(),OP_SELL,LOT,Bid,3,FRCU+((SAF*Point)+SPRW),CLOSE-(DFS*KOF), "DOKTRADE",15885,0,Red);
return(0);
}
}
for(CNT=0;CNT<TOTAL;CNT++)
{
OrderSelect(CNT,SELECT_BY_POS,MODE_TRADES);
{
if (OrderType()==OP_BUY && OrderSymbol()==Symbol())
{
if (OPEN>EMAL&&CLOSE<EMAL)
OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet);
return(0);
}
if (OrderType()==OP_SELL && OrderSymbol()==Symbol())
{
if (OPEN<EMAH&&CLOSE>EMAH)
OrderClose(OrderTicket(),OrderLots(),Ask,3,Blue);
return(0);
}
}
}
}
Good afternoon!
Guys, please help me figure out where I'm going wrong. I have Aroon Up&Dn indicator.
I am trying to put it into my Expert Advisor... It does not want to open orders:
Hi all, I wrote an EA! In the tester, everything works, but in the real account, it refuses to open positions! Note that he closes manually opened positions very well, but, precisely to open, does not want to ... What do I do?
First of all, look at errors in log... For price parameters when sending order NormalizeDouble is highly recommended.
To start with, look at the errors in the logbook... For price parameters when sending an order NormalizeDouble is highly recommended.
You can go to https://docs.mql4.com/ru/array/ArrayMaximum
on an array of High.
Good afternoon!
Guys, please help me figure out where I'm going wrong. I have Aroon Up&Dn indicator.
I am trying to put it into my Expert Advisor... It does not want to open orders:
I think because of this
if (Volume[0]>1) return;
Thanks for the tip, but if you can be more specific... Because the log doesn't show anything apart from the synchronisation! Please advise, may be something to add somewhere? Yes, and closes normally... I.e. on closing everything works...!
Actually, it's nonsense to ask such questions to an expert writer :) So, you are not mature enough to be a beginner. If you want to check check positions and limit values for closeness to the open price, you'll probably learn a thing or two about Chinese grammar.
I think that's why.
if (Volume[0]>1) return;
No, that's not it.
Thank you all, I've got it. It worked