Please help me find an EA (script) which either puts a grid of virtual pending orders with specified parameters, or opens orders (one by one) in a specified direction with a specified take.
SELL_STOP - the orders are calculated, but SELL doesn't want it. According to the algorithm, if there are none, the SELL_STOP order is placed, and if there is at least one of them, the order is not placed.
SELL_STOP - orders are counted, but SELL does not want. According to the algorithm, if there are none, the SELL_STOP order is placed, and if at least one of them is present, no order is placed.
//+------------------------------------------------------------------+//| Script 1.mq5 |//| Copyright 2020, MetaQuotes Software Corp. |//| https://www.mql5.com |//+------------------------------------------------------------------+#property copyright"Copyright 2020, MetaQuotes Software Corp."#property link"https://www.mql5.com"#property version"1.00"//---#include <Trade\PositionInfo.mqh>
#include <Trade\OrderInfo.mqh>
//---CPositionInfo m_position; // object of CPositionInfo classCOrderInfo m_order; // object of COrderInfo class//---//+------------------------------------------------------------------+//| Script program start function |//+------------------------------------------------------------------+voidOnStart()
{
int count_buys = 0.0;
int count_sells = 0.0;
int count_buy_limits = 0.0;
int count_sell_limits = 0.0;
int count_buy_stops = 0.0;
int count_sell_stops = 0.0;
//---for(int i=PositionsTotal()-1; i>=0; i--)
if(m_position.SelectByIndex(i)) // selects the position by index for further access to its properties
{
if(m_position.PositionType()==POSITION_TYPE_BUY)
count_buys++;
elseif(m_position.PositionType()==POSITION_TYPE_SELL)
count_sells++;
}
//---for(int i=OrdersTotal()-1; i>=0; i--) // returns the number of current ordersif(m_order.SelectByIndex(i)) // selects the pending order by index for further access to its properties
{
if(m_order.OrderType()==ORDER_TYPE_BUY_LIMIT)
count_buy_limits++;
elseif(m_order.OrderType()==ORDER_TYPE_SELL_LIMIT)
count_sell_limits++;
elseif(m_order.OrderType()==ORDER_TYPE_BUY_STOP)
count_buy_stops++;
elseif(m_order.OrderType()==ORDER_TYPE_SELL_STOP)
count_sell_stops++;
}
//--- you code
}
//+------------------------------------------------------------------+//+------------------------------------------------------------------+
I don't understand what the parameter begin in the second version of onCalculate function is responsible for. Every time onCalculate function is called, it equals 0. I was outputting the value of begin via print function. The reference book says that begin is "where the meaningful data starts from". This doesn't tell me anything.
MisterRight: I don't understand what parameter begin in second variant of onCalculate function is responsible for. Every time onCalculate function is called, it equals 0. I made the output of begin value via print function. The reference book says that begin is "where meaningful data starts from". This doesn't tell me anything.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
How do I understand the account type programmatically? Hedge or netting?
Or like this
m_label_info[3].Description(m_account.MarginModeDescription());\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Please tell me where the error lies:
SELL_STOP - the orders are calculated, but SELL doesn't want it. According to the algorithm, if there are none, the SELL_STOP order is placed, and if there is at least one of them, the order is not placed.Please tell me where the error lies:
SELL_STOP - orders are counted, but SELL does not want. According to the algorithm, if there are none, the SELL_STOP order is placed, and if at least one of them is present, no order is placed.Don't confuse the LOCAL ORDER with the POSITION.
Don't confuse the REMOTE ORDER with the POSITION.
Every time onCalculate function is called, it equals 0.
I was outputting the value of begin via print function.
The reference book says that begin is "where the meaningful data starts from". This doesn't tell me anything.
I don't understand what parameter begin in second variant of onCalculate function is responsible for.
Every time onCalculate function is called, it equals 0.
I made the output of begin value via print function.
The reference book says that begin is "where meaningful data starts from". This doesn't tell me anything.
Look at the open indicator codes from Example.
Look at the open indicator codes from Example.
I looked. Always begin = 0.
Here, I pulled a piece of code from AMA indicator
if(begin!=0)
PlotIndexSetInteger(0,PLOT_DRAW_BEGIN,ExtPeriodAMA+begin);
And what should this code tell me if the condition begin!=0 is never true?
It gives out some nonsense in the end, much more than closed orders.