[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 938

 
q1shock:


here's an example from the boys =)


Thanks for the reply. Sketched out a rudimentary EA. It still does not work.

extern int HourStartTrade = 14;
extern int MinuteStartTrade = 30;
extern int TakeProfit = 690;
extern int StopLoss=250;
static int PrevTime=0;
extern int DeltaTimenow=1200;

int start()
{
if (Time[0]<=PrevTime) return(0);
{
PrevTime=Time[0];
int ticket;
if (Hour () == HourStartTrade && Minute() == MinuteStartTrade)
{
ticket=OrderSend(Symbol(),OP_BUY,0.1,Ask,3,Ask-StopLoss*Point,Ask+TakeProfit*Point, "EMA BUY",0,0,CLR_NONE);
datetime expiration = 0;
expiration = {(TimeCurrent() + DeltaTimenow)};
Print("expiration = ",expiration);
ticket=OrderSend(Symbol(),OP_SELLSTOP,0.1,Ask-StopLoss*Point,3,Bid,Ask-StopLoss*Point, "EMA SELL",expiration,0,CLR_NONE);
}
}
}
return(0);

 
artmedia70:

You need to adjust the digits for the yen if you are working with it and the order symbol contains JPY. Do not worry - this function will do everything for you. And it should be placed, as well as any other functions outside the body of the EA. And you should call it from the EA as follows:


beyond the int start function, or beyond any function in the int start body?
 
gheka:
beyond the int start function, or beyond any function in the int start body?
Beyond the limit of any function at all.
 
Can anyone tell me where to get the settings files in Metatrader, after testing the EA in the tester, and the test report
 
71bags:
Can anyone tell me where to get the settings files in Metatrader, after testing the EA in the tester, and the test report

Have you tried saving it?
 
Vinin:

Have you tried saving?
I need the file to send to the programmer
 
71bags:
I need a file to send to the programmer
I saved an image-- that's not it.
 
71bags:
I was saving an image - that's not it
And save it as a report? Or save it as an itemised report? I mean, you can try it and not just write questions... And then wait for an answer...
 
artmedia70:
And save it as a report? Or save it as an itemised report? You can try it, rather than writing questions right away... And then wait for an answer...
Tell me how
 
extern double SL=20; // SL для открываемого ордера
extern double TP=20; // ТР для открываемого ордера
extern double Lot=0.01; // Жестко заданное колич. лотов
datetime time;
//--------------------------------------------------------------- 2 --
int start()
{
int Total;

double
M_0,
M_1;


bool
Ans =false, // Ответ сервера после закрытия
Cls_B=false, // Критерий для закрытия Buy
Cls_S=false, // Критерий для закрытия Sell
Opn_B=false, // Критерий для открытия Buy
Opn_S=false; // Критерий для открытия Sell

//--------------------------------------------------------------- 3 --
// Учёт ордеров


for(int i=OrdersTotal()-1;i>=0;i--)
if (OrderSelect(i,SELECT_BY_POS)&&OrderSymbol()==Symbol()&&OrderType()>1)Total++;

if(Total!=0 || time==Time[1])return;


// Торговые критерии

M_0=iOsMA(NULL,0,13,34,8,0,0); // 0 бар
M_1=iOsMA(NULL,0,13,34,8,0,1); // 1 бар



if (M_1<0 && M_0>0)
Opn_B=true;

if (M_1>0 && M_0<0)
Opn_S=true;

//--------------------------------------------------------------- 7 --


if (Opn_B)
{OrderSend(Symbol(),OP_BUY,Lot,Ask,0,Bid-SL*Point,Bid+TP*Point);time=Time[1];}

if (Opn_S)
{OrderSend(Symbol(),OP_SELL,Lot,Bid,0,Ask+SL*Point,Ask-TP*Point);time=Time[1];}
}


An EA that opens a position when the OsMA crosses the zero line. It is not clear where it opens and it is not clear why. Can someone look, maybe an error in iOsMA(NULL,0,13,34,8,0,0)?
Reason: