[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 186

 
NTH >> :

Hello.

Why is the stop not transferring for buy positions? for sell everything is working.

if(OrdersTotal()>0)
{
if(Bid==bubuy||Bid==busell)
{
OrderSelect(ticket, SELECT_BY_TICKET, MODE_TRADES);
OrderModify(OrderTicket(),OrderOpenPrice(),OrderTakeProfit(), 0, Blue);
}
return(0);
}

originally what is if(Bid==buy||Bid==busell),....??????? can you tell.

and probably the following condition should be:

OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*number of points,OrderTakeProfit(),0,Blue)

 

if(Bid==buy||Bid==busell)

double bubuy is a level on touching which the stop of the buy position is moved to the opening level of this position.

double busell is the level for a sell position.

 
NTH >> :

if(Bid==bubuy||Bid==busell)

double bubuy is a level on touching which the stop of the buy position is moved to the opening level of this position.

double busell is a level for a sell position.

check the condition anyway.

 

Figured it out

if(OrdersTotal()>0)
{
OrderSelect(ticket, SELECT_BY_TICKET, MODE_TRADES);
if(OrderStopLoss()==OrderOpenPrice()) return(0);
if (OrderType()==OP_BUY) if(Bid>=buy) OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice(),OrderTakeProfit(), 0, Blue);
if(OrderType()==OP_SELL) if(Bid<=busell) OrderModify(OrderTicket(),OrderOpenPrice(),OrderTakeProfit(), 0, Red);
return(0);
}

And another question, if data are taken from several TFs, is it necessary for the EA to open all these charts (in different ones) when it works online, or may I take only one chart and set the EA on it? Suppose the EA works on EUR/OD takes data from H1 H4 D1 frames for analysis, and it (the EA) is attached to H1, should I open in other charts H4 and D1?

 
NTH >> :

Figured it out

if(OrdersTotal()>0)
{
OrderSelect(ticket, SELECT_BY_TICKET, MODE_TRADES);
if(OrderStopLoss()==OrderOpenPrice()) return(0);
if(OrderType()==OP_BUY) if(Bid>=buy) OrderModify(OrderTicket(),OrderOpenPrice(),OrderTakeProfit(), 0, Blue);
if (OrderType()==OP_SELL) if(Bid<=busell) OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice(),OrderTakeProfit(), 0, Red);
return(0);
}

And another question, if my EA takes data from several TFs, do I need all these TFs to be open (in different charts) when EA works online or can I take only one chart and set EA on it? Suppose the EA works on EUR/OD takes data from H1 H4 D1 frames for analysis, and attached to H1, does it need to open in other charts H4 and D1?

No need to open other charts with timeframes... The EA will calculate all the data from the timeframes itself.

 

Hi, could you please tell me how to fix the indicator https://www.mql5.com/ru/code/7361.

The matter is that the signal appears on the current bar, and with each tick a sound signal sounds. I would like to have a sound after the bar closes, if the signal is not cancelled.

//+------------------------------------------------------------------+
//| SilverTrend_Signal.mq4                                           |
//| Ramdass - Conversion only                                        |
//+------------------------------------------------------------------+
#property copyright "SilverTrend  rewritten by CrazyChart"
#property link      "http://viac.ru/"
//----
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Aqua
#property indicator_color2 Violet
//---- input parameters
extern int RISK=3;
extern int CountBars=350;
extern int NumberofAlerts=2;
int SSP=9;
int counter=0;
//---- buffers
double val1[];
double val2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   string short_name;
//---- indicator line
   IndicatorBuffers(2);
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,233);
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,234);
   SetIndexBuffer(0, val1);
   SetIndexBuffer(1, val2);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| SilverTrend_Signal                                               |
//+------------------------------------------------------------------+
int start()
  {
   if ( CountBars>=Bars) CountBars=Bars;
   SetIndexDrawBegin(0,Bars- CountBars+ SSP);
   SetIndexDrawBegin(1,Bars- CountBars+ SSP);
   int i, shift, counted_bars=IndicatorCounted();
   int i1, i2, K;
   double Range, AvgRange, smin, smax, SsMax, SsMin, price;
   bool uptrend, old;
//----
   if(Bars<= SSP+1) return(0);
//---- initial zero
   if( counted_bars< SSP+1)
     {
      for( i=1; i<= SSP; i++) val1[ CountBars- i]=0.0;
      for( i=1; i<= SSP; i++) val2[ CountBars- i]=0.0;
     }
//----
   K=33- RISK;
   for( shift= CountBars- SSP; shift>=0; shift--)
     {
      Range=0;
      AvgRange=0;
      for( i1= shift; i1<= shift+ SSP; i1++)
        { AvgRange= AvgRange+MathAbs(High[ i1]-Low[ i1]);
        }
      Range= AvgRange/( SSP+1);
//----
      SsMax=High[ shift]; SsMin=Low[ shift];
      for( i2= shift; i2<= shift+ SSP-1; i2++)
        {
         price=High[ i2];
         if( SsMax< price) SsMax= price;
         price=Low[ i2];
         if( SsMin>= price)  SsMin= price;
        }
      smin= SsMin+( SsMax- SsMin)* K/100;
      smax= SsMax-( SsMax- SsMin)* K/100;
      val1[ shift]=0;
      val2[ shift]=0;
      if (Close[ shift]< smin)
        {
         uptrend=false;
        }
      if (Close[ shift]> smax)
        {
         uptrend=true;
        }
      if ( uptrend!= old && uptrend==true)
        {
         val1[ shift]=Low[ shift]- Range*0.5;
         counter=0;
         if ( shift==0 && counter<= NumberofAlerts)
           {
            Alert("Silver Trend ",Period()," ",Symbol()," BUY");
            counter= counter+1;
           }
        }
      if ( uptrend!= old && uptrend==false)
        {
         counter=0;
         val2[ shift]=High[ shift]+ Range*0.5;
         if ( shift==0 && counter<= NumberofAlerts)
           {
            Alert("Silver Trend ",Period()," ",Symbol()," SELL");
            counter= counter+1;
           }
        }
      Comment( shift);
      old= uptrend;
     }
   return(0);
  }
//+------------------------------------------------------------------+
 
People met who met an expert Martingail Two hands 2.07 exactly 2.07 or just 2.7 may not quite rightly wrote the name, as it is downloaded from one site along with a bunch of other tested 2 weeks and he did more than 100% two weeks konestno little but I did not have time to test it further because I had to farm the drive urgently. May who met?
 
I also have a request to put in this tip profit, I do not get it, please.
Files:
 

Greetings all!


Help me solve the following problem.

There is a custom indicator that draws signals on the chart.

The signals are given with a delay, which I am trying to determine for each signal and write next to it on the chart.

I decided to try to output the time of signal's appearance:

ObjectCreate(StringConcatenate("Text_",IndicatorNumber,"_",i), OBJ_TEXT, 0, "cur_time",short[i] + 0.0020);
ObjectSetText(StringConcatenate("Text_",IndicatorNumber,"_",i), TimeToStr(CurTime(),TIME_SECONDS), 10, "Arial", Lime);

But the code doesn't work, I can't see the time.

What am I doing wrong?

 

Hello.

I have downloaded with "Quote Archive" the pound/dollar (M1) quotes from 1999 in DAT format, how can I convert this data for testing?

Reason: