[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 117

 
TarasBY:

Like this:

The ZigZag extrema from the current time to Time_Control are collected in an array.


void fGet_ExtremumsZZPrice (string fs_Symbol,           // инструмент
                            int fi_TF,                  // таймфрейм
                            datetime fdt_TimeControl,   // время, до которого ищем экстремумы
                            int fi_ExtDepth = 12,       // ExtDepth         
                            int fi_ExtDeviation = 5,    // ExtDeviation
                            int fi_ExtBackstep = 3)     // ExtBackstep
{
    double ld_Value, lda_Extremum[];
    int    li_size = iBarShift (fs_Symbol, fi_TF, fdt_TimeControl), li_IND = 0;
//---- 
    for (int li_Bar = 1; li_Bar < li_size; li_Bar++)
    {
        ld_Value = iCustom (fs_Symbol, fi_TF, "ZigZag", fi_ExtDepth, fi_ExtDeviation, fi_ExtBackstep, 0, li_Bar);
        if (ld_Value != 0.)
        {
            ArrayResize (lda_Extremum, li_IND + 1);
            lda_Extremum[li_IND] = ld_Value;
            li_IND++;
        }
    }
//---- 
}

Can you tell me how to count all the zigzags, how many are there?

 

Hello,

sorry in advance for the grammar :/. My question is, how to rewrite quotes history (via code)? I would like to use MT4 to analyse data from another broker.
 
berezhnuy:

Can you tell me how to count all the zigzags, how many are there?




Written in the li_IND variable, or like this
count=ArraySize(lda_Extremum);
 
berezhnuy:

Can you tell me how to count all the zigzags, how many are there?

If we do the following:

int fGet_ExtremumsZZPrice (string fs_Symbol,           // инструмент
                           int fi_TF,                  // таймфрейм
                           datetime fdt_TimeControl,   // время, до которого ищем экстремумы
                           int fi_ExtDepth = 12,       // ExtDepth         
                           int fi_ExtDeviation = 5,    // ExtDeviation
                           int fi_ExtBackstep = 3)     // ExtBackstep
{
    double ld_Value, lda_Extremum[];
    int    li_size = iBarShift (fs_Symbol, fi_TF, fdt_TimeControl), li_IND = 0;
//---- 
    for (int li_Bar = 1; li_Bar < li_size; li_Bar++)
    {
        ld_Value = iCustom (fs_Symbol, fi_TF, "ZigZag", fi_ExtDepth, fi_ExtDeviation, fi_ExtBackstep, 0, li_Bar);
        if (ld_Value != 0.)
        {
            ArrayResize (lda_Extremum, li_IND + 1);
            lda_Extremum[li_IND] = ld_Value;
            li_IND++;
        }
    }
//----
    return (li_IND);
}
- the function will return the number of extrema found since fdt_TimeControl.
 

Thank you

 

Hello,

Is it possible to enter a schedule with a fixed weight 1:1 in the settings?

If it is possible, please tell me how.

I would like to thank you in advance.

 
Can you tell me please, my candlesticks change colours every few seconds on the chart to coloured and back to black and white. This has never happened before. Is there any way to turn it off?
 

Afternoon.

I wrote code to open two pending orders (BuyStop and SellStop) on conditions a=true and b=true and after some time the EA closes both orders, until a new signal appears, but sometimes the EA opens 2 pending orders in the same direction. Why this happens and how to avoid this "bug"?



if (a=true && b=true)
{
int OrderCount = OrdersTotal();
if (OrderCount>1) return(0);
ticket1=OrderSend(Symbol(), OP_BUYSTOP, getLot(), PriceOpen_Buy, slippage, PriceOpen_Sell,0,0,Green);
Sleep(1000);

ticket2=OrderSend(Symbol(), OP_SELLSTOP, getLot(), PriceOpen_Sell, slippage, PriceOpen_Buy,0,0,Green);

Sleep(1000*59*TimeFrame);

for (int i=OrdersTotal()-1; i>=0; i--)
{
if (!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) break;
if (OrderType()==OP_BUYSTOP ) OrderDelete(OrderTicket());
if (OrderType()==OP_SELLSTOP ) OrderDelete(OrderTicket());
if (OrderType()==OP_SELL ) OrderClose(OrderTicket(),OrderLots(),Ask,slippage);
if (OrderType()==OP_BUY ) OrderClose(OrderTicket(),OrderLots(),Bid,slippage);
}

return(0);

}


Please give me a hint.

Thank you in advance.

 
r772ra:



The values of these variables are stored in the arrays-traceboxes.

I mean, you've got it like this .

Terms and conditions,

Thanks, I'll try it that way)
 
Shixan:

Afternoon.

I wrote code to open two pending orders (BuyStop and SellStop) on conditions a=true and b=true and after some time the EA closes both orders, until a new signal appears, but sometimes the EA opens 2 pending orders in the same direction. Why this happens and how to avoid this "bug"?

Please advise.

Thank you in advance.

Maybe here:

if (OrderCount>0) return(0);

Actually so much is not "sleeping" - Sleep(1000*59*TimeFrame); - a new tick came in, your code started, two orders open, then pause for "2 hours" (conditionally), and then you try to close if suddenly one of the orders became marketable at the prices you got 2 hours ago - ORIGINAL!!! WHO TAUGHT YOU THAT?

You can fix in a global variable the time of opening of orders and control the difference between m³ TimeCurrent() and the fixed time.