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

 
Integer:

Move the cursor to the first opening bracket after OrderSend, delete this bracket, re-enter, this will bring up a tooltip with the type of parameters, check if all parameters are of the same type.

Thanks so much, I didn't put an order exp iry date in, now it works!
 
Integer:
Measured the speed of forward and reverse cycle. 100 orders, the reverse cycle is 5 times faster. But there are never so many orders, 10 at the most. If there are 10 orders, the speed is 3 times faster. It is palpable to choose the reverse cycle.

Does the loop execute in one tick or in several?
 
Example2:

Is the loop executed in a single tick or in several ticks?

I don't get it. It just executes and that's it, ticks have nothing to do with it at all.
 
//|+-------------------------------------------------------------------------------------------------------+
//|Inputs                                                                                                  |
//|+-------------------------------------------------------------------------------------------------------+
extern double Lots_Typ = 0.1;
extern double TP_Typ = 100;
extern double SL_Typ = 100;
extern double Timeframe = 0; 
//|+-------------------------------------------------------------------------------------------------------+
extern double _N_  = 1;
//|+-------------------------------------------------------------------------------------------------------+
extern double Line_6  = 2.5;
extern double Line_7  = 3;
extern double Line_8  = 3.5;
extern double Line_9  = 4;
extern double Line_10 = 4.5;
extern double Line_11 = 5;
//|+-------------------------------------------------------------------------------------------------------+
extern double RSI_Type_Line_1 = 0;
extern double RSI_Period_Line_1_1 = 5;
extern double ADX_Type_Price_1 = 0;
extern double ADX_Period_Line_1 = 5;
extern double RVI_Period_Line_1 = 5;
extern double Stohastic_MA_Metod_1 = 0;
extern double Stochastic_Period_Line_A_1 = 10;
extern double Stochastic_Period_Line_B_1 = 6;
//|+-------------------------------------------------------------------------------------------------------+
extern double RSI_Type_Line_2 = 0;
extern double RSI_Period_Line_1_2 = 10;
extern double ADX_Type_Price_2 = 0;
extern double ADX_Period_Line_2 = 10;
extern double RVI_Period_Line_2 = 10;
extern double Stohastic_MA_Metod_2 = 0;
extern double Stochastic_Period_Line_A_2 = 10;
extern double Stochastic_Period_Line_B_2 = 6;
//|+-------------------------------------------------------------------------------------------------------+
extern double RSI_Type_Line_3 = 0;
extern double RSI_Period_Line_1_3 = 20;
extern double ADX_Type_Price_3 = 0;
extern double ADX_Period_Line_3 = 20;
extern double RVI_Period_Line_3 = 20;
extern double Stohastic_MA_Metod_3 = 0;
extern double Stochastic_Period_Line_A_3 = 10;
extern double Stochastic_Period_Line_B_3 = 6;
//|+-------------------------------------------------------------------------------------------------------+
//|Declaration                                                                                             |
//|+-------------------------------------------------------------------------------------------------------+
double Line_1_A; double Line_2_A; double Line_3_A;
double Line_1_B; double Line_2_B; double Line_3_B;
double Line_1_C; double Line_2_C; double Line_3_C;
double Line_1_D; double Line_2_D; double Line_3_D;
double Line_1_I; double Line_2_I; double Line_3_I;
double Line_1_F; double Line_2_F; double Line_3_F;
double Line_1_K; double Line_2_K; double Line_3_K;
double Line_1_L; double Line_2_L; double Line_3_L;
double Line_1_M; double Line_2_M; double Line_3_M;
//|+-------------------------------------------------------------------------------------------------------+
double Lines_1; 
double Lines_2;
double Lines_3;
//|+-------------------------------------------------------------------------------------------------------+
double price;
//|+-------------------------------------------------------------------------------------------------------+
//|+-------------------------------------------------------------------------------------------------------+
//|Start                                                                                                   |
//|+-------------------------------------------------------------------------------------------------------+
//|+-------------------------------------------------------------------------------------------------------+
//|Level 1                                                                                                 |
//|+-------------------------------------------------------------------------------------------------------+
int start() 
{ 
    //|+---------------------------------------------------------------------------------------------------+
    //|Level 2                                                                                             |
    //|+---------------------------------------------------------------------------------------------------+
    price = Bid;
    //|+---------------------------------------------------------------------------------------------------+
    Line_1_A = iRSI(Symbol(),Timeframe,RSI_Period_Line_1_1,RSI_Type_Line_1,0);
    Line_1_M = iRSI(Symbol(),Timeframe,RSI_Period_Line_1_2,RSI_Type_Line_1,0);
    Line_1_L = iRSI(Symbol(),Timeframe,RSI_Period_Line_1_3,RSI_Type_Line_1,0);
    Line_1_B = iStochastic(Symbol(),Timeframe,Stochastic_Period_Line_A_1,Stochastic_Period_Line_B_1,Stochastic_Period_Line_B_1,Stohastic_MA_Metod_1,0,0,0);
    Line_1_K = iStochastic(Symbol(),Timeframe,Stochastic_Period_Line_A_1,Stochastic_Period_Line_B_1,Stochastic_Period_Line_B_1,Stohastic_MA_Metod_1,0,1,0);
    Line_1_C = iADX(Symbol(),Timeframe,ADX_Period_Line_1,ADX_Type_Price_1,0,0);
    Line_1_D = iADX(Symbol(),Timeframe,ADX_Period_Line_1,ADX_Type_Price_1,1,0);
    Line_1_I = iADX(Symbol(),Timeframe,ADX_Period_Line_1,ADX_Type_Price_1,2,0);
    Line_1_F = iRVI(Symbol(),Timeframe,RVI_Period_Line_1,ADX_Type_Price_1,0);
    //|+---------------------------------------------------------------------------------------------------+
    Line_2_A = iRSI(Symbol(),Timeframe,RSI_Period_Line_1_1,RSI_Type_Line_2,0);
    Line_2_M = iRSI(Symbol(),Timeframe,RSI_Period_Line_1_2,RSI_Type_Line_2,0);
    Line_2_L = iRSI(Symbol(),Timeframe,RSI_Period_Line_1_3,RSI_Type_Line_2,0);
    Line_2_B = iStochastic(Symbol(),Timeframe,Stochastic_Period_Line_A_2,Stochastic_Period_Line_B_2,Stochastic_Period_Line_B_2,Stohastic_MA_Metod_2,0,0,0);
    Line_2_K = iStochastic(Symbol(),Timeframe,Stochastic_Period_Line_A_2,Stochastic_Period_Line_B_2,Stochastic_Period_Line_B_2,Stohastic_MA_Metod_2,0,1,0);
    Line_2_C = iADX(Symbol(),Timeframe,ADX_Period_Line_2,ADX_Type_Price_2,0,0);
    Line_2_D = iADX(Symbol(),Timeframe,ADX_Period_Line_2,ADX_Type_Price_2,1,0);
    Line_2_I = iADX(Symbol(),Timeframe,ADX_Period_Line_2,ADX_Type_Price_2,2,0);
    Line_2_F = iRVI(Symbol(),Timeframe,RVI_Period_Line_2,ADX_Type_Price_2,0);
    //|+---------------------------------------------------------------------------------------------------+
    Line_3_A = iRSI(Symbol(),Timeframe,RSI_Period_Line_1_1,RSI_Type_Line_3,0);
    Line_3_M = iRSI(Symbol(),Timeframe,RSI_Period_Line_1_2,RSI_Type_Line_3,0);
    Line_3_L = iRSI(Symbol(),Timeframe,RSI_Period_Line_1_3,RSI_Type_Line_3,0);
    Line_3_B = iStochastic(Symbol(),Timeframe,Stochastic_Period_Line_A_3,Stochastic_Period_Line_B_3,Stochastic_Period_Line_B_3,Stohastic_MA_Metod_3,0,0,0);
    Line_3_K = iStochastic(Symbol(),Timeframe,Stochastic_Period_Line_A_3,Stochastic_Period_Line_B_3,Stochastic_Period_Line_B_3,Stohastic_MA_Metod_3,0,1,0);
    Line_3_C = iADX(Symbol(),Timeframe,ADX_Period_Line_3,ADX_Type_Price_3,0,0);
    Line_3_D = iADX(Symbol(),Timeframe,ADX_Period_Line_3,ADX_Type_Price_3,1,0);
    Line_3_I = iADX(Symbol(),Timeframe,ADX_Period_Line_3,ADX_Type_Price_3,2,0);
    Line_3_F = iRVI(Symbol(),Timeframe,RVI_Period_Line_3,ADX_Type_Price_3,0);
        //|+-----------------------------------------------------------------------------------------------+
        //|Level 3                                                                                         |
        //|+-----------------------------------------------------------------------------------------------+
        Lines_1 = price * (_N_ * (((Line_1_B + Line_1_F) / Line_1_K) - ((Line_1_D + Line_1_I) / Line_1_C) + ((Line_1_A + Line_1_M) / Line_1_L)));
        //|+-----------------------------------------------------------------------------------------------+
        Lines_2 = price * (_N_ * (((Line_2_B + Line_2_F) / Line_2_K) - ((Line_2_D + Line_2_I) / Line_2_C) + ((Line_2_A + Line_2_M) / Line_2_L)));
        //|+-----------------------------------------------------------------------------------------------+
        Lines_3 = price * (_N_ * (((Line_3_B + Line_3_F) / Line_3_K) - ((Line_3_D + Line_3_I) / Line_3_C) + ((Line_3_A + Line_3_M) / Line_3_L)));
            //|+-------------------------------------------------------------------------------------------+
            //|Level 4 Auto_Sistem_1                                                                       |
            //|+-------------------------------------------------------------------------------------------+  

            if(Line_7 > Lines_1 && Lines_1 > Line_6)
            {
            Alert("Сигнал на покупку (2.5 , 3)");
            OrderSend(Symbol(),OP_BUY,Lots_Typ,Ask,5,SL_Typ,TP_Typ);
            }
            return;}}
This is my truncated grief-expert. :)
Doesn't do deals.
I can't figure out the reason.
Help, please.
 

The tester constantly gives error 138 (Requested price out of date) when closing several open positions. Moreover, one position closes normally, while the one opened later does not close with error 138. Perhaps the developers can answer, how can the price become obsolete based on historical data or is there some other parameters that are used in the algorithm for identifying this error? If we place OrderClose into the infinite loop with constant reference to RefreshRates inside it, the position is not closing and error 138 is shown anyway. Of course, the loop is not terminated, although we have set exit upon position closing.

My demo account was opened at Alpari. I haven't loaded the history additionally, but there are a lot of errors, like: 2013.12.29 16:27:09 TestGenerator: unmatched data error (volume limit 10340 at 2013.08.23 12:00 exceeded), etc.

Can anyone advise what to do in this situation? And what is this tester that cannot close positions within a few 4 hour candles?

 
Link_x:
This is my truncated grief-expert. :)
Doesn't do deals.
I can't figure out the reason.
Help, please.
Test in visual mode. Use Comment() to output Line_7, Lines_1, Line_6. See how they change, whether the conditions can be fulfilled at all.
 
Example2:

for (int i = 0; i < OrdersTotal(); i++){
if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES) == true){
Profit = Profit + OrderProfit() + OrderCommission() + OrderSwap();
}

}

Only "Profit" needs to be declared as a fractional variable. If we add a check for Buy and Sell, we will be able to calculate the profit separately for Sell and Buy orders.


Thanks, I got it...but how to close all open orders for all currency pairs at once? .... - also using brute force? .... - no other options?
 
Integer:
Test in visual mode. Use Comment() to output Line_7, Lines_1, Line_6. See how they change and if the conditions can be met at all.


The transaction conditions are fulfilled, but the transaction is not.
 
i999i:

Thanks, I see what I mean about profit ... but how do I close all open orders for all symbols simultaneously? .... - also using brute force? .... - no other variants?


You should also take into consideration that if there is more than one order, they might not all be closed in one cycle. You should also take into consideration that if there is more than one order, they might not all be closed in one cycle, and the conditions will not be met on the next tick and the remaining orders will remain open. That is why we need an additional global or static variable. If the close conditions are fulfilled, we set this variable to true. Then, on every tick, if the variable is true, we close all orders in the loop; if we have managed to close all of them, we set variable false.

 
Link_x:

The transaction conditions are met, but the transaction is not completed.



And there is a message in the log "Signal to buy (2.5, 3)"?

After OrderSend(), call GetLastError() and see the error code.

Reason: