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

 
granit77:

Where have you been before? You're right. I've added it, it works.


Thank you very much from me too! I've been "pestering" with this question on various threads here - here's one "fruitful" at last :)) !

Another question from another point of view: if I prescribe an order opening at Open[0] after МА crossing 40% of positions are not opened - I ignore them completely (more correctly, 40%)) and if I prescribe an opening at Ask or Bid - it opens a lot of "extra" positions which should not be opened. This is especially relevant to currencies with big spreads, such as EURNZD, for instance.

Can you fight it? If I open with Open[0] slippage equal to spread, it acts like with Ask opening - in other words, it is a vicious circle.

//+------------------------------------------------------------------+
//| Check for open order conditions                                  |
//+------------------------------------------------------------------+
void CheckForOpen()
  {
   double ma;
   int    res;
    
//---- go trading only for first tiks of new bar
   if(Volume[0]>1) return;
//---- get Moving Average 
   ma=iMA(NULL,0,MovingPeriod,MovingShift,MODE_SMA,PRICE_CLOSE,0);
//---- sell conditions
   if(Open[1]>ma && Close[1]<ma)  
     {
      res=OrderSend(Symbol(),OP_SELL,Lots,Bid,30,Bid+Stoploss*Point,Bid-Takeprofit*Point,"",MAGICMA,0,Red);
      return;
     }
//---- buy conditions
   if(Open[1]<ma && Close[1]>ma)  
     {
      res=OrderSend(Symbol(),OP_BUY,Lots,Ask,30,Ask-Stoploss*Point,Ask+Takeprofit*Point,"",MAGICMA,0,Blue);
      return;
     }
//----
  }

	          
 
obla4ko:

Thank you very much from me too! I've been "pestering" with this question on various threads here - here's one "fruitful" at last :)) !

Another question from another point of view: if I prescribe an order opening at Open[0] after МА crossing 40% of positions are not opened - I ignore them completely (more precisely 40%)) and if I prescribe an opening at Ask or Bid - it opens a lot of "extra" positions which should not be opened. This is especially relevant to currencies with big spreads, such as EURNZD, for instance.

Can you fight it? If I set the slippage at the Open[0] opening equal to the spread, it acts like on the Ask opening - in other words, it is a vicious circle.


Have you tried to control the number of open positions?
 
artmedia70:
Well done, Victor!
And the cloud is silent... :))
not silent :)) ... just answered in the wrong place - :))
 
Vinin:

Have you tried controlling the number of open positions?
Yes, we have. Only one position for one instrument is active.
 
obla4ko:

Thank you very much from me too! I've been "pestering" with this question on various threads here - here's one "fruitful" at last :)) !

Another question from another direction: if I prescribe an order opening at Open[0] after МА crossing 40% of positions are not opened - I completely ignore them (more correctly, 40% of them)) and if I prescribe an opening at Ask or Bid - it opens a lot of "extra" positions which should not be opened. This is especially relevant to currencies with big spreads, such as EURNZD, for instance.

Can you fight it? If I open with Open[0], the slippage is equal to the value of spread, then it works like with Ask opening - in other words, it is a vicious circle.

To open a Buy position, one should use the Ask price and open a Sell position using the Bid price.

It is necessary to check the result returned by the OrderSend() function. If the position is opened, it must be taken into account that the buy/sell signal is passed and not to repeat the opening request, but to wait for the next signal.

 
PapaYozh:

The buy position must be opened at Ask price and the sell position at Bid price.

You have to check the result returned by the OrderSend() function. If you open an order, you must take into account that the buy/sell signal is gone and not repeat the opening request, but wait for the next signal.

Yes! In fact, I cannot correctly write the following :

- If on the given bar the position was closed at StopLoss, and it is suitable by parameters for opening a new position, it should NEVER be opened on it! In other words -

StopLoss - (1)

OPEN - (0) for the current bar.

Then the Expert Advisor works optimally - a minimum of "unnecessary" positions.

And I always get some kind of abracadabra.

 
obla4ko:

Yes! Actually, I can't get the following right :

- If a position has closed at StopLoss on a given bar, and it is suitable for opening a new position according to the parameters, then you should NEVER open a position on it! In other words -

StopLoss - (1)

OPEN - (0) for the current bar.

Then the Expert Advisor works optimally - a minimum of "unnecessary" positions.

And I always get some kind of abracadabra... :((

I told you to set the timer not to open for 4 bars after the stop is triggered
 
Techno:
i told you, set the timer not to open for 4 bars after the stop is triggered

I remember :), your advice is good, but "it's all about nuances", as PapaYozh puts it !

When working with averages every bar counts - statistics, you know! :)) - so you have to look for other, more subtle, solutions....

 
you can set the ban at 1 or 2 bars. it can't get any thinner than that
 

Good afternoon to all forum members!

Couldn't find answers to the following questions.

1. Two terminals are running on different machines (first one at work, second one at home), on the same real account.

If one Expert Advisor on one and the same currency pair is running on these terminals, on the same currency pair,

is it equivalent to running the same EA on the same pair in different windows of the same terminal?

2. If you disable the operation of EAs in one of these terminals (by using the appropriate button), how will this

affect another terminal?

(Thank you in advance!)

Reason: