[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 982

 
Aleksander:

declare a variable

at start - when a signal is received, increase it by 1, when N signals are received, open a trade,

reset counter...

I've written as much as I can, but it's not clear how to design the signal addition...
extern double     PropuskSignala             =  0;  //сколько сигналов инлдикатора пропускать
//-------------------
double PropuskSignalaB,PropuskSignalaS;

//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
//получаем сигнал: (SignalBuy==true;)
PropuskSignalaB++;  //вот здесь как записать? Чтобы прибавлялись
//получаем сигнал: (SignalSell==true;)
PropuskSignalaS++;  //вот здесь как записать? Чтобы прибавлялись

if(SignalBuyif(PropuskSignalaB>=PropuskSignala || PropuskSignalaS>=PropuskSignala){
//открываем ордер Buy
}
if(SignalSellif(PropuskSignalaS>=PropuskSignala || PropuskSignalaB>=PropuskSignala){
//открываем ордер Sell
}
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
 

Good afternoon!

Please help me with this question. I made an Expert Advisor. I want to know if I can work with the yield curve that it produces. The question is which curve can be considered the minimum "curve" :). I have given my curve. 1999 -2010.

P.S. The question is not idle. When I place it on real account, the curve will go down temporarily.

 
001:

Good afternoon!

Please help me with this question. I have made an Expert Advisor. I want to know if I can work with the yield curve that it produces. The question is which curve can be considered the minimum "curve" :). I have given my curve. 1999 -2010.

P.S. The question is not idle. When I place it on real account, the curve will go down temporarily.

It all depends on the code of the EA itself. Maybe it's completely bare - just a toy for the tester. What a bar test you have here. Does the EA have explicit bar opening control?
 
artmedia70:
It all depends on the code of the EA itself. Maybe it's completely bare - just a toy for the tester. Well, what about the bar test? Does the EA have explicit control of bar opening?


Yes, of course it does.

static int PrevTime=0;
int start()
{

if (Time[0]<=PrevTime) return(0);
{
PrevTime=Time[0];

}

Explain the first two phrases, please.

 

I don't understand the textbook,

does "break" stop the whole loop and the Expert Advisor waits for a new tick?

and can it be used in "if-else", let's say if it is "break" ?

 
gheka:

I don't understand the textbook,

does "break" stop the whole loop and the Expert Advisor waits for a new tick?

and can it be used in "if-else", let's say if it is "break" ?

break terminates the whole loop and continues executing your code from the next line after the closing parenthesis of the loop statement block.

in if-else you can use it. How else would you check the criteria for aborting a loop???

 
The OrderModify() function creates a separate entry in the trading history. I use it when writing an EA to implement Trailing Stop. I.e., if condition of Trailing Stop is fulfilled and StopLoss moves, and it can happen every segunday, then the same number of lines will appear in the history. Is there any way to avoid this? The Trailing Stop built into MetaTrader works normally.
 
dzam:
The OrderModify() function creates a separate record in the trading history. I use it when writing an Expert Advisor for implementing Trailing Stop. I.e., if condition of Trailing Stop is fulfilled and StopLoss moves, and it can happen every segunday, then the same amount of lines will appear in the history. Is there any way to avoid this? The Trailing Stop built into MetaTrader works normally.

Isn't it easier to implement a trawl using price, stop value, stop distance from price and trawl step?

Or is it more interesting to walk to the entrance from the bench via Zimbabwe?

 
artmedia70:

Wouldn't it be simpler to use price, stop value, stop distance from price and trawl step to implement the trawl???

Or, is it more interesting to walk to the entrance from the bench through Zimbabwe?

OK, we go in through the front entrance. Attention, one more question:

Here is a snippet of code from the example of TrailingStop implementation

/---- проверяем, не надо ли передвинуть Стоп Лосс:
        //---- если размер трейлингстопа не слишком маленький,
        if ( TrailingStop > MarketInfo( Symbol(), MODE_STOPLEVEL ) )
        {
            //---- если прибыль позиции больше TrailingStop пунктов,
            if ( NormalizeDouble( Bid - _BuyOpenPrice, Digits ) > 
                  NormalizeDouble( TrailingStop*Point, Digits ) )
            {
                //---- если новый уровень стоплосса выше, чем сейчас у позиции
                //---- (или если у позиции нет Стоп Лосса),
                if ( NormalizeDouble( Bid - TrailingStop*Point, 
                    Digits ) > _BuyStopLoss
                      || _BuyStopLoss <= 0.0 )
                {
                    //---- модифицируем ордер
                    if ( !OrderModify( _BuyTicket, _BuyOpenPrice, 
                          NormalizeDouble( Bid - TrailingStop*Point, 
                                           Digits ), 
                          _BuyTakeProfit, 0 ) )
                    {
                        Alert( "OrderModify Error #", 
                              GetLastError() );
                        return(-1);
                    }
                }                     

}

This piece of code uses OrderModify() to modify an order according to TrailingStop conditions. Function OrderModify() creates a separate record in the trading history. That is, if the Trailing Stop conditions are met and Stop Loss moves, and this can happen every second, the same amount of lines will appear in the history. Is there any way to avoid this? The Trailing Stop built into MetaTrader works normally.

 
dzam:

OK, let's go in through the front door. Attention, one more question:

Here is a piece of code from the example implementation of TrailingStop

}

This piece of code uses OrderModify() to modify an order according to TrailingStop conditions. Function OrderModify() creates a separate record in the trading history. That is, if the Trailing Stop conditions are met and Stop Loss moves, and this can happen every second, the same amount of lines will appear in the history. Is there any way to avoid this? The Trailing Stop built into MetaTrader works properly.


There is no way to avoid it. Each trade, like any position modification, creates its own log entry
Reason: