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

 
MaxZ:

That's an interesting idea. I wouldn't come to it any time soon! Thanks! :D

Except that I've loaded myself up a bit. There's no way a floating spread can affect it, is there?


The floating spread will always have an effect.

But it will have an effect on opening a counter as it would have an effect on closing it piece by piece. OrderCloseBy() is not affected by the spread.

 
PapaYozh:


Floating spread will always be affected.

But it will affect the opening of the counter as it would affect the piece-by-piece closing. OrderCloseBy() is not affected by the spread in any way.

That's what I wanted to hear.

Is there such a thing that not all brokers allow counter orders to be closed with OrderCloseBy()?

 
MaxZ:

That's what I wanted to hear.

Is there such a thing that not all brokers allow to close counter orders with OrderCloseBy()?


First, counter orders must be allowed.

And secondly.

 

Hi

Guys, how do I make trades not close when the total drawdown is 30% (EA stops working) ?

Maybe there is a link?

Thanks in advance!

 

Help find an error!


avatar
10
mamba5 18.08.2011 14:23

I am writing an EA based on "Black MACD" strategy:


Currency pair: any

Time frame: 15 and more.

Indicators: EMA(3) EMA(18), RSI(14), MACD(12,26,9)

Remove the signal line of the MACD indicator, all indicators are applied to the Close price indicator.

Buy entry signal: EMA(3) crosses EMA(18) from bottom to top, wait for the MACD to show positive side. If RSI(14) is above the 50 level, then buy. Stop-loss is set at the last local minimum. Exit the trade by reversing the EMA crossover, or use your own approach.

Signal to sell: Reverse situation: Crossing of EMA(3) EMA(18) downwards, wait for MACD to be negative. If RSI(14) is below 50, then buy. Stop-loss is set to the last high.


When compiling the code it says that a bracket is missing. After a long search I seemed to have found where it should be, but after fixing the error I got another 20-30 new bugs. Please, advise me where i missed it. ))) The code is in the attached file.

Attached files:
BlackvMACD.mq4 (5.21 KB) delete
 

Dear !

Please give me the formula in mathematical form for calculating the concept "ACCELERATION - acceleration factor" in Parabolic. I can't figure it out in the code yet...

 
serg1:

Dear !

Please give me the formula in mathematical form for calculating the concept "ACCELERATION - acceleration factor" in Parabolic. I can't figure it out in the code yet...


google
 
PapaYozh:


First of all counter trades should be allowed.

And secondly.

Everything has become more or less clear. Thank you for your answers! :))


smartemiy:

Hi

Hey guys, how should I make trades not close if I have a total drawdown of 30% (EA stops working)?

Maybe there is a link?

Many thanks in advance!

Hello!

Somehow this will not work for you?

if (AccountProfit() < -0.3*AccountBalance())
   return(0);
 
Hello, could you please tell me if it is possible to implement a trailing stop algorithm without using OrderModify? I would like to fix minimal profit as soon as the order reaches profit, i.e. to remember the level, and then, if the order "went" in the right direction, to move this level after it.
 
I am using this example
//----
 for (i=0; i<OrdersTotal(); i++)
   {
      OrderSelect(i, SELECT_BY_POS );
      if (OrderSymbol() == Symbol()){    //  Alert("i",i,"   ","OrderOpenPrice()",OrderOpenPrice(),"  ","OrderTicket()",OrderTicket());                                                                                                     
      
      
                                           
     if (OrderMagicNumber() == 1000 && OrderType() == OP_BUY  && Bid-OrderOpenPrice() > 30*Point && Bid-OrderStopLoss() > 15*Point)  {
            OrderModify(OrderTicket(), OrderOpenPrice(), Bid-15*Point, OrderTakeProfit(), 0);                                                 Alert("OrderModify-BAY", GetLastError(),"OrderTicket()",OrderTicket(),"Bid-15*Point",Bid-15*Point);                                        }
      if (OrderMagicNumber() == 2000 && OrderType() == OP_SELL && OrderOpenPrice()-Ask > 30*Point && OrderStopLoss()-Ask > 15*Point)  {                                                                    
            OrderModify(OrderTicket(), OrderOpenPrice(), Ask+15*Point, OrderTakeProfit(), 0);  Alert("OrderModify-SELL", GetLastError(),"OrderTicket()",OrderTicket(),"Ask+15*Point",Ask+15*Point);                                       }
                                    }
  }
The stop moves from reaching 30 pips profit (minus Spread, etc.) in a distance of 15 pips from the price.
OrderProfit( )
more than zero, and in general, according to your needs.
Reason: