Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 510

 
isn-88:


TakeProfit is not correct in the order submission. The price should be specified, not the number of nanopips of profit. Correct to Ask+TakeProfit*Point()
Ask, Bid need not be normalized....

OrderSend(

Symbol(),

OP_BUY,

StartLot,

Ask,

Slippage,

0,

Ask+TakeProfit*Point(),

WindowExpertName()+" "+(string)0,

0,

0,

clrBlue

);


Thank you. What do you need void init and deinit for? I understand deinit, it only executes code when the robot is running. When the robot starts, right? And init ?

How you can use code. That is, I don't have to worry about the five digits. How do I know if I currently have a five-digit code?

 
Zolotai:

Thank you. What is the void init and deinit for? I understand deinit, it only executes code when the robot starts. When robot starts, right? And init ?
It's init that's executed when the robot starts. deinit is executed when the robot unloads.
 
evillive:
it is the init that is executed at startup. deinit is executed at upload.


What do they mean when unloading. If I remove the robot from the chart or stop it? I'm not quite sure what needs to be written in deinit? I just stop it or I have to delete something else?
 
The robot is unloaded from memory when removed from the chart and when the terminal is closed. At least look through the manual for a while, it's very useful and takes a lot of questions off the table.
 
evillive:
The robot is unloaded from memory when removed from the chart and when the terminal is closed. At least look through the manual for a while, it's very useful and takes a lot of questions off the table.


So, what will I need to prescribe in this function. How do I know it?

 

if ((hi-low)<=max_koridor_v_punktah)
{
int buy = OrderSend(Symbol(), OP_BUYSTOP, LotBuy, OpenBuy, 0, StopLossBuy, 0);//open buy order.

if (buy>0)
{
Alert ("BuyStop order set ",buy);
}
int sell= OrderSend(Symbol(), OP_SELLSTOP, LotSell, OpenSell, 0, StopLossSell, 0);//open a sell order.
if (sell>0)
{
Alert ("SellStop order set ",sell);
}
if (DayOfWeek()==5 && Hour()==22) //delete pending and open orders on Friday at 23:00 server time
{
if (OrderSelect(sell,SELECT_BY_TICKET)==true)
{
OrderClose(sell,OrderLots(),Bid,3,Green);//(Ticket,lot,closing price, slippage in pips,colour of the closing arrow on the chart); { Close market order to sell.
OrderDelete(sell);//closing the Sell Limit.
}
if (OrderSelect(buy,SELECT_BY_TICKET)==true)
{
OrderClose(buy,OrderLots(),Ask,3,Red);//(Ticket,lot,close price,slippage in points,colour of the close arrow on the chart); //closing the market buy order.
OrderDelete(buy);//closing the buy limit.
return(0);
}
}
}

Who can tell me why it doesn't close orders and delete limits?

 

Folks, throw me a link.

Or how to go through the loop, active orders?

 

Good day, Dear Sirs!

I need to call the variables: maximum of the day, minimum of the day, closing and opening price of the current day, and the opening price of the next day!

Regards, AlexMikash

 
AlexMikash:

Good day, Dear Sirs!

I need to call the variables: maximum of the day, minimum of the day, closing and opening price ofthe current day, and the opening price of the next day!

Regards, AlexMikash


I will be happy to hear from you.

 
AlexMikash:

Good day, Dear Sirs!

I need to call the variables: maximum of the day, minimum of the day, closing and opening price of the current day, and opening price of the next day!

Regards, AlexMikash

https://docs.mql4.com/ru/series

if(DayOfWeek()==1,2..... && Hour()==1,2....)
{
double hi=iHigh(NULL,0,iBarShift(NULL,0,iTime(NULL,PERIOD_D1,0));//define high
double low=iLow(NULL,0,iBarShift(NULL,0,iTime(NULL,PERIOD_D1,0));//define low.

/////////////////////////////////////////////////////////////////////////////////////////////////

double op=iOpen(NULL,0,iBarShift(NULL,0,iTime(NULL,PERIOD_D1,0));//define opening.