[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 637

 
Oh, so I've got it right?
 
FAQ 17.03.2012 12:18
Most likely, at the moment of opening you have zero in thepriceBUY variable, so Bid-priceBUY(0)==Bid, and therefore

No, if it were so, then the SELL would also be trawled incorrectly, while the SELL works fine...... I already tried changing the initial value of priceBUY from "0" to "open price".... does not work, my brain is already fried(((

 
MIR-ASOV:

No, if it were, SELL wouldn't work correctly either, but SELL works fine...... I already tried changing initial value of priceBUY from "0" to "open price" .... does not work, my brain is already fried(((

What's stopping you from using code like this?

   
   extern int ts=25, minp=10;

for(int i = OrdersTotal(); i >= 0; i--)
     {
       OrderSelect(i, SELECT_BY_POS, MODE_TRADES); 
       // check for symbol & magic number
       if(OrderSymbol() == Symbol() && OrderMagicNumber() == Magic) 
         {
          if(OrderType() == OP_BUY) // long position is opened
            {
               if((Bid-OrderOpenPrice())>Point*(ts+minp)) // trall
                 {
                  if(OrderStopLoss()<Bid-Point*ts)
                    {
                      if(!OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(Bid-Point*ts,Digits),0,0,Orange)) {Sleep(11000); prevtime = Time[1];}
                    }
                 }
            } 
           if(OrderType() == OP_SELL) // short position is opened
            {

               if((OrderOpenPrice()-Ask)>Point*(ts+minp))// trall
                {
                 if(OrderStopLoss()>Ask+Point*ts)
                   {
                       if(!OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(Ask+Point*ts,Digits),0,0,Orange))
                      {
                        Sleep(11000);
                        prevtime = Time[1];
                      }
                   }
                }

            }
          }
     }
//----

Everything works as it should.

 

Happy St Patrick's Day everyone!

Dear, I'm asking for help. Help me to get a signal out of an indicator into an EA. I.e. if a blue line appears - buy, if red - sell.

Wrote so in owl:

double dn_stop_1 = iCustom(NULL,0,"NRTR_ATR_STOP",ATR,Coeficient,0,1); // синий, снизу
double up_stop_1 = iCustom(NULL,0,"NRTR_ATR_STOP",ATR,Coeficient,1,1); // красный, сверху

   if (dn_stop_1!=EMPTY_VALUE)
       return(1);//покупка
   if (up_stop_1!=EMPTY_VALUE)  
       return(-1);//продажа

I have not got anything, it seems buffers are always equal to 0.

Files:
 

evillive А что мешает использавать вот такой код?


If there is only one order in the example (either BUY or SELL), but if there are more orders, then I need all orders to be trailed from the level of total breakeven. And it is important for me to understand what is the reason in this code, because the SELL order is executed excellently, what is missing for BAY? Why does it modify the stop immediately after opening......!?
 
MIR-ASOV:


In this example I only have one order (either BUY or SELL), but if there is more than one, I want all orders to be taken from Breakeven. And it is important for me to understand what is the reason in this code, because SELL order is executed in a good way, what is missing for BAY? Why does it modify the stop immediately after opening......!?


Because the price being compared is not :

1) initialised

2) equal to zero

Actions:

1) uninitialise and see,

2) initialize with a large number

3) trap if compared price is equal to zero

 
Sancho77:

Happy St Patrick's Day everyone!

Dear, I'm asking for help. Help me to get a signal out of an indicator into an EA. I.e. if a blue line appears - buy, if red - sell.

Wrote so in owl:

I have not got anything, it seems buffers are always equal to 0.



And why are you comparing with EMPTY_VALUE. You are comparing with 0.0
 
Because the comparable price is not :

1) инициализирована

2) is equal to zero.

Actions:

1) unprinter and see,

2) initialize with a large number

3) set a trap if the compared price is equal to zero.

Thanks for your help, thanks to everyone who responded...... It worked, I swapped the "Breakeven Level Calculation" with the "Position Opening" block and everything worked as it should...... Thanks again everyone)))) And I'm going to hang myself)
 
Vinin:

And why are you comparing with EMPTY_VALUE. You are comparing with 0.0.

I tried it this way too:

   if (dn_stop_1!=0.0)
       return(1);
   if (up_stop_1!=0.0)  
       return(-1);

Still no response.

 

Can you tell me if there is something in the code MTFindyuka make that it automatically computed and redid the history, ideally every minute that would not turn out here is such krakozobraha

In the picture there are two МТФinduks for 5 min, on the one-minute chart.

ExtMapBuffer1[i]=iCustom(Symbol(),TimeFrame, "T-Line alert10",0,y);

ExtMapBuffer2[i]=iCustom(Symbol(),TimeFrame, "T-Line alert10",1,y);

I've got to get normal view, i.e. smooth steps, to choose properties of the indicator and press "OK" or "refresh graphic".If I use m1 and MTF5m I'm tired to refresh it manually sometimes, maybe I can simply implement it by attaching some smart function, I don't want to write a separate code for each indicator.

Reason: