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

 
logut:
How can i prescribe in the codes of my EAs that they work with each of my currency pairs? I've got a different symbol but it doesn't work.
I'm not sure if I'm using a single symbol for a different currency pair, but the same symbol is enough.
 
Hello. I have written an EA, it shows good results in the tester. Compiles without errors. It is attached to the euro dollar.
In real trade trades do not open, when conditions to open a trade appear it gives a message:
2015.02.11 14:03:03.656 '1435109': order buy 0.01 EURUSD opening at market sl: 1.12697 tp: 1.13747 failed [Invalid S/L or T/P]
As I understand it means that this is not a valid stop or take. An order with given stops and takes is placed manually. There is a distance between the price and the stop
There is several times more distance between the price and the point. All calculations of the stop and the current are normalized. What may be the reason, I do not understand, please help me to understand.
Here is the program:
int start()
{
//------------------------------------------------------------------------------------------------

if (OrdersTotal()>0)
return;
double monymax8=High[ArrayMaximum(High,3,0)];
if (I removed the condition itself because it is not the reason, since the program reaches the OrderSend function)

{ double stop_sell8=monymax8+Point;
double STOP_S8=NormalizeDouble(stop_sell8,Digits);
double profit_sell8=Bid-(stop_sell8-Bid)*4-(Ask-Bid);
double PROFIT_S8=NormalizeDouble(profit_sell8,Digits);
double my_lot8=AccountBalance()/100/((stop_sell8-Bid)*MarketInfo(Symbol(),MODE_TICKVALUE))/100000;
double LOT8=NormalizeDouble(my_lot8,2);
OrderSend(Symbol(),OP_SELL,LOT8,Bid,2,STOP_S8,PROFIT_S8);
}
//------------------------------------------------------------------------------------------------
return;
}

 
Rogoza:
Hello. I have written an EA, it shows good results in the tester. Compiles without errors. It is attached to the euro dollar.
In real trade trades do not open, when conditions to open a trade appear it gives a message:
2015.02.11 14:03:03.656 '1435109': order buy 0.01 EURUSD opening at market sl: 1.12697 tp: 1.13747 failed [Invalid S/L or T/P]
As I understand it means that this is not a valid stop or take. An order with given stops and takes is placed manually. There is a distance between the price and the stop
There is several times more distance between the price and the point. All calculations of the stop and the current are normalized. What may be the reason, I do not understand, please help me to understand.
Here is the program:
int start() 
 {
 
//------------------------------------------------------------------------------------------------
if (OrdersTotal()>0)
   return;
   
   double monymax8=High[ArrayMaximum(High,3,0)];
   
       
        if (само условие я убрал так как не в нём причина, раз программа доходит до функции  OrderSend)
        {   double stop_sell8=monymax8+Point;
            double STOP_S8=NormalizeDouble(stop_sell8,Digits);
            double profit_sell8=Bid-(stop_sell8-Bid)*4-(Ask-Bid);
            double PROFIT_S8=NormalizeDouble(profit_sell8,Digits);
            double my_lot8=AccountBalance()/100/((stop_sell8-Bid)*MarketInfo(Symbol(),MODE_TICKVALUE))/100000;
            double LOT8=NormalizeDouble(my_lot8,2);
           
             
           OrderSend(Symbol(),OP_SELL,LOT8,Bid,2,STOP_S8,PROFIT_S8);
            
                   
        }
      
 //------------------------------------------------------------------------------------------------
   return;
 } 

Format your code like this. There is an SRC button for this.

It does not open because on these account types, orders without stops are opened first, and then OrderModify()

 
evillive:
The magik is only needed if there are several "traders" on the same symbol, but that's enough to check the symbol.
i see. now what i'm worried about is how to make the EA multi-currency?
 
AlexeyVik:

Format your code like this. There is the SRC button for this purpose.

It doesn't open because in these account types, orders without stops are opened first, and then OrderModify()

Thank you very much! I will rewrite the code.
 
logut:
So I get it. Now my question is how to make the EA multi-currency ???
Open a kodobase, find a multi-currency EA there and figure out how it works.
 

Generally, I'm really stumped on something and can't figure out how to do it.

I have variables line1,line2,line3 etc. I want to count the value for each variable through the for loop statement.

How to make a correct enumeration of variables line? I tried to do it as "line "+"i", but it turns out nonsense, of course.

for(int i=1;i<=111111111111;i++)
        {
            if("line"+"i">0)counter++;
        }
 
Probably better to make an array line[] and then loop through.
 

Why is it displaying the wrong object? It should bea triangle pointing lefthttps://docs.mql4.com/ru/constants/objectconstants/arrows code 3, but an arrow pointing upwards Wingdings code 241appears.

obj

Program code (I haveObjectSet(objName, OBJPROP_ARROWCODE, 3);)

void f_ArrowClose(
                  datetime closeTime,
                  int action,          //íàïðàâëåíèå
                  double lots,
                  string symb,
                  double openPrice,
                  double closePrice,
                  double profit)
{
      color c;
      string op="";
      if(action==1)
      {
         if(profit>0)c=Blue;else if(profit<0)c=Red;else c=Yellow;
         op="cl_BUY";
      }
      else if(action==-1)
      {
         if(profit>0)c=Blue;else if(profit<0)c=Red;else c=Yellow;
         op="cl_SELL";
      }
      
      string objName = StringConcatenate("#", closeTime, " ", op, " ", lots, " ", symb, " at ", openPrice, " close at ", closePrice);
      ObjectCreate(objName, OBJ_ARROW, 0, closeTime, closePrice);
      ObjectSet(objName, OBJPROP_COLOR, c);
      ObjectSet(objName, OBJPROP_ARROWCODE, 3);
      //ObjectSetText(objName, StringConcatenate("Profit: ", profit));
}
 
gince:

Why is it displaying the wrong object? It should bea triangle pointing lefthttps://docs.mql4.com/ru/constants/objectconstants/arrows code 3, but an arrow pointing upwards Wingdings code 241appears.

Program code (I haveObjectSet(objName, OBJPROP_ARROWCODE, 3);)

Read it more carefully. I don't remember in detail, but code 3 is not part of Wingdings.


ps; Here's what's in the note.

Special arrow codes cannot be used in custom indicators when setting the arrow value for lineswith DRAW_ARROW style.

Reason: