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

 


Does MetaTrader4 no longer support processors like AMD Duron 750?

I honestly don't understand why you have to upgrade

for the sake of one program. Well they made Mt5 with its requirements, why touch Mt4 :(

Please tell me where I can get the old version that is supported by Mt4 so I can run Mt4.

Or better yet post a link here.

 
There isn't one, support for older builds has been discontinued.
 

Please help me to change the money management in my EA code.

There are 2 conditions in my EA

1 - minimum lot + working with fixed lot or 2 - increasing lot in % of available funds

I want the lot to increase by 0.01 lot after the 1st unsuccessful transaction, or by 0.02 lot after the 2nd unsuccessful transaction,

and after the 3rd loss the lot is minimal again.

I need functions that I could paste into my EA (preferably as simple as possible)

I tried to put in code through include (lot_lib) it generates a lot of errors and does not work.

Thanks in advance for your time!


 

Hello!

I'm writing code, the point is to put the stop loss level at the lowest/highest point of the last three bars. Here's what came out:

double FindSL(int mode)
   {
    double sl; //уровень стоплосса
    double buf; //буфер
    double lvl1, lvl2, lvl3; //выборка из 3-х последних баров
    if (mode == 1) //покупали
      {
       lvl1 = iLow(symb, 0, 0);
       lvl2 = iLow(symb, 0, 1);
       lvl2 = iLow(symb, 0, 2);
       buf = MathMin(lvl1, lvl2); //ищем низ
       sl = MathMin(buf, lvl3);
      }
    else if (mode == 2) //продавали
      {
       lvl1 = iHigh(symb, 0, 0);
       lvl2 = iHigh(symb, 0, 1);
       lvl3 = iHigh(symb, 0, 2);
       buf = MathMax(lvl1, lvl2); //ищем вершину
       sl = MathMax(buf, lvl3);
      }
    return (sl);
   }

Orders are opened by the following code:

int OpenOrder(int sell_or_buy)                                  //Открытие ордеров
   {
    GetLot();

     if(sell_or_buy==2)                                          //покупка
       {
        StopLoss = FindSL(1);
        OrderSend(symb, OP_BUYSTOP, Lots, iHigh(symb, 0, 1), 0, StopLoss, 
        iHigh(symb, 0, 1)+TakeProfit*Point, "Ichimoku Simple Adviser Trade", 1001, TimeCurrent()+ExpirationTime, Green);    
        return (1);
       }
     else if (sell_or_buy==1)                                    //продажа
       {
        StopLoss = FindSL(2);
        OrderSend(symb, OP_SELLSTOP, Lots, iLow(symb, 0, 1), 0, StopLoss, 
        iLow(symb, 0, 1)-TakeProfit*Point, "Ichimoku Simple Adviser Trade", 1001, TimeCurrent()+ExpirationTime, Red);
        return (1);
       }
     else {return (0);}
   } 

StopLoss is a global variable.

When testing, there comes a moment when money runs out, all at once, in one trade. Lots are small, so the only problem is that the stoploss is not set for some reason (equal to 0)

I can't figure out what the error is.

Look at the code please, where could I make a mistake?

 
gogent:

Hello!

I'm writing code, the point is to put the stop loss level at the lowest/highest point of the last three bars. Here's what came out:

Orders are opened by the following code:

StopLoss is a global variable.

When testing, there comes a moment when money runs out, all at once, in one trade. Lots are small, so the only problem is that the stoploss is not set for some reason (equal to 0)

I can't figure out what the error is.

Please look at the code, where i could make a mistake?

Stop loss is always 0 after purchases.

Reason: variable lvl3 is not defined (mechanical error)

 

Hello.

I'm dealing with the spread. The spread is always against me. So I have to add it to a stop loss and subtract it from a take profit? So, if I want to get a net profit of 50 pips (say, 3 pips spread on a currency pair), it means that I have to set a take profit of 53 pips in my order. If I have a net loss of 50 pips, then a stop loss of 47 pips should be given. Did I get it right?

Thanks in advance!

 
01123456789:

Hello.

I'm dealing with the spread. The spread is always against me. So I should add it to a stop loss and subtract it from a take profit? So, if I want to get a net profit of 50 pips (say, 3 pips spread on a currency pair), it means that I have to set a take profit of 53 pips in my order. If I have a net loss of 50 pips, then a stop loss of 47 pips should be given. Did I get it right?

Thanks in advance!


Hello!

If we are talking about your plans and expectations, that's right.

If we're speaking formally, it's not clear to me what it means to "specify in the order ... " on the order..."

 

Hello! Help me out with a custom function.

I understand: if condition is true, it returns for isitpik- (true). The condition is calculated from the 0th buffer where the calculation from AO lies. Or only last i-bar lies in the buffer and at occurrence of conditions for these criteria then (true) is passed to isitpik()? And why assign int type to variable (i) if it is done by condition above.


bool isitpik( int i )
   {
   if(ExtBuffer0[i]>0 && ExtBuffer0[i]>ExtBuffer0[i+1] && ExtBuffer0[i]>ExtBuffer0[i-1])return(true);
   if(ExtBuffer0[i]<0 && ExtBuffer0[i]<ExtBuffer0[i+1] && ExtBuffer0[i]<ExtBuffer0[i-1])return(true);
   }
 
tara:


Hello!

If it's about your plans and expectations, that's fine.

If we are being formal, it is not clear to me what "Take Profit =53 pips" means in the order..."

When I said: "I meant a pending order (for example, Buy Stop) with two columns for Stop Loss and Take Profit. That is, if I want to get a profit of 50 pips, I should specify 53 points of take profit in the pending order, instead of 50 because 3 points will affect the spread. Right?
 
01123456789:
By saying: "I meant a pending order (for example, Buy Stop) with two columns for Stop Loss and Take Profit. That is, if I want to get a profit of 50 pips, I should specify 53 points of take profit in the pending order, instead of 50 because 3 points will take away the spread. Right?

In orders, TP and SL should be specified in prices, not in points.
Reason: