[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 340

 
Thank you all. I think we've got it all worked out.
 
smogsam >> :

Hello.

How do I know if the SL or TP is triggered. For example, if an order closes on

SL or TP, execute so-and-so. I have not found such function.

There are no standard functions, but you can add signals in the terminal window (sound, file, mail).

If you use an EA, you can add both a signal and an alert and .....

 
So what? I need an expert.
 

One more question. If(OrdersTotal()==0) this... if the number of open orders is equal to zero... then how will it be...if the number of orders opened FOR DAY is zero.

Isn't there something like OrdersDayTotal?

 
smogsam >> :
So what? I need to be in an expert.

Well, like what

"If you use an EA you can add both a signal and an alert and ....."

"..." It could be anything up to shutting down the PC.

 
future >> :

One more question. If (OrdersTotal()==0) this... if the number of open orders is equal to zero... If the number of orders opened FOR THE DAY is equal to zero, what would happen?

Isn't there something like OrdersDayTotal?

Suppose a Buy order is opened, then we close a Buy order on a Sell signal, or a Buy order is opened, then we scale in on a Buy signal

OrderType()

See Help

MQL4 Reference - Trading Functions - OrderType

OrderOpenTime( )
 

Apparently none of the pros work with dd.

Maybe someone knows how to get in touch with mamadu? he is the author of the article,

on which I've been asking questions all over the internet (to no avail). He is Dmitriy.

 
smogsam >> :

Hello.

How do I know if the SL or TP is triggered. For example, if an order is closed at

SL or TP, execute this or that. I did not find this function.

I use the following scheme.

//Determine whether the previous trade ended with a profit or a loss
//------------------------------------------------------------------------------------------------------------------------------------------------
if (OrderSelect(Tic_Verh,SELECT_BY_TICKET)==true)
{
if (OrderComment()=="[sl]")_SL[0]=-1;
if (OrderComment()=="[tp]")_SL[0]=1;
}
if (OrderSelect(Tic_Niz,SELECT_BY_TICKET)==true)
{
if (OrderComment()=="[sl]")_SL[0]=-1;
if (OrderComment()=="[tp]")_SL[0]=1;
}
Variables of INT type are marked in red, they contain numbers of TICs when opening a position

Variable _SL[0] is declared as a one-dimensional array of one element. i.e. int _SL[1]

 

Please advise how to write an EA and I can't make it out. I open a buy order at a given time, if the price deviates below 10 pips a sell order should open.
The first order opens for buy and when the price deviates to the low level the sell order is not opened. If the market goes up by 10 pips the order closing function is not started.
here is a part of the code


.......................
.......................


bool opb1=true;
bool ops1=true;
int start()
{

int Cur_Hour=Hour(); // Server time in hours
double Time_Cls=9.25;
double Cur_Min=Minute();
double Cur_time=Cur_Hour + Cur_Min*0.01; // Current time


if (Cur_time>=Time_Cls)

{
if (opb1==true){

double bid =MarketInfo("EURUSD",MODE_BID);
double ask =MarketInfo("EURUSD",MODE_ASK);
double point =MarketInfo("EURUSD",MODE_POINT);
double bid1 =bid+50*Point;
double ask1=ask-50*Point;
double bid2=bid;
double ask2=ask-100*Point;


OrderSend(Symbol(),OP_BUY,0.1,Ask,50,Bid-400*Point,Bid+200*Point);
Alert (GetLastError());

opb1=false;}

if(MarketInfo("EURUSD",MODE_BID)>= bid1)


{
Close_All(0); //close buy function
return(0);
}
if(MarketInfo("EURUSD",MODE_ASK)<=ask1)

{
ask =MarketInfo("EURUSD",MODE_ASK); //
bid =MarketInfo("EURUSD",MODE_BID); //
point =MarketInfo("EURUSD",MODE_POINT);//
if (ops1==true){
OrderSend(Symbol(),OP_SELL,0.3,Bid,50,Ask+400*Point,Ask-200*Point);
Alert (GetLastError());
ops1=false;}
if(MarketInfo("EURUSD",MODE_ASK)<=ask2)
{
Close_All(1);// close sell function
Close_All(0);
return(0);
}
or maybe I am setting the open condition wrong?

 

Please advise how to write an EA and I can't make it out. I open a buy order at a given time, if the price deviates below 10 pips a sell order should open.
The first order opens for buy and when the price deviates to the low level the sell order is not opened. If the market goes up by 10 pips the order closing function is not started.
here is a part of the code


.......................
.......................


bool opb1=true;
bool ops1=true;
int start()
{

int Cur_Hour=Hour(); // Server time in hours
double Time_Cls=9.25;
double Cur_Min=Minute();
double Cur_time=Cur_Hour + Cur_Min*0.01; // Current time


if (Cur_time>=Time_Cls)

{
if (opb1==true){

double bid =MarketInfo("EURUSD",MODE_BID);
double ask =MarketInfo("EURUSD",MODE_ASK);
double point =MarketInfo("EURUSD",MODE_POINT);
double bid1 =bid+50*Point;
double ask1=ask-50*Point;
double bid2=bid;
double ask2=ask-100*Point;


OrderSend(Symbol(),OP_BUY,0.1,Ask,50,Bid-400*Point,Bid+200*Point);
Alert (GetLastError());

opb1=false;}

if(MarketInfo("EURUSD",MODE_BID)>= bid1)


{
Close_All(0); //close buy function
return(0);
}
if(MarketInfo("EURUSD",MODE_ASK)<=ask1)

{
ask =MarketInfo("EURUSD",MODE_ASK); //
bid =MarketInfo("EURUSD",MODE_BID); //
point =MarketInfo("EURUSD",MODE_POINT);//
if (ops1==true){
OrderSend(Symbol(),OP_SELL,0.3,Bid,50,Ask+400*Point,Ask-200*Point);
Alert (GetLastError());
ops1=false;}
if(MarketInfo("EURUSD",MODE_ASK)<=ask2)
{
Close_All(1);// close sell function
Close_All(0);
return(0);
}
or maybe I am setting the open condition wrong?