Useful features from KimIV - page 67

 
diakin писал(а) >>
By the way, the magic number cannot be changed through OrderModify(). Or maybe I have missed something again? ;-()

no, not modify. The list of what can be changed is indirectly seen in the OrderModify() parameters:

  • price - only for orders.
  • stoploss
  • takeprofit
  • expiration - only for orders.

So, only two parameters can be changed for positions (stop and take profit), and we can change four parameters for orders.

 
Which signals should be used to enter the market?
 
004alex >> :
What signals should be used to enter the market?

>> And you tell us which signals to use to exit, and we'll be even ;)

 

heh... Where there's an entrance, there's an exit (c) Kissing fallen angels

 
it can't be, there has to be a gap (c) :))
 
Can you tell me what to do, so that when TekeProfit is triggered the EA will continue its work, and when StopLoss is triggered, it will start working from the very beginning, i.e. from int init(), and again until StopLoss is triggered?

extern double MM=200.00;
extern double my_lot=0.01;

/+------------------------------------------------------------------+
int init()
{
OrderSend(Symbol(),OP_BUY,my_lot,Ask,3,0,Ask+MM*Point,NULL,0,0,CLR_NONE);
return;
}
//+------------------------------------------------------------------+
int start()
{
int total=OrdersTotal();
//-----------

if(total==0)
{
OrderSend(Symbol(),OP_BUY,my_lot,Ask,3,Ask-MM*Point,Ask+MM*Point,NULL,0,0,CLR_NONE);

return;
}
}
 
KimIV >> :

no, not modify. The list of what can be changed is indirectly seen in the OrderModify() parameters:

  • price - only for orders.
  • stoploss
  • takeprofit
  • expiration - only for orders.

So, only two parameters can be changed for positions (stop and take profit), and we can change four parameters for orders.

Please help me

Chor. Here is the idea.

By a simple variant.

When connecting to the chart, the Expert Advisor opens a Buy order at the price of 1.5000 with TP of 25 pips and lot size of 0.1.

And immediately sets a pending SellStop after 25 points with TP of 50 points, lot size 0.2, and StopLoss of 75 points.

Further, if the price went upwards and Bai closed, the pendent is deleted.

Rest 5 sec. And we repeat first two points

But if the price goes down and the pendentive has triggered, then

On the first order with 0.1 lot we increase TP to 50 pips and set a stop loss of 75 pips.

And we place a Stop Loss pending order at 1.5000 point with a TP of 50p. Sotploss 75п. and lot size 0.3

Further, if the price went down, all open orders should close - Sell at TP, and Buy at Stoploss.

But if the price turns around again, we continue the same way we did before but only up to the 5th order triggered.

At the point of opening of the 6th Sell, the system of closing all orders is activated, by overlapping orders of course.

And then it's back to the same thing.

 
ollpd писал(а) >>
Can you tell me what to do, if I set TekeProfit to work and if I set StopLoss to work, will I start working from the beginning, i.e. from int init(), and again until StopLoss is triggered?

>> I'll give you a hint:

if (isCloseLastPosByStop()) init();
 
KimIV >> :

prompt:

if (isCloseLastPosByStop()) init();

Thank you very much Igor Viktorovich, but may be it possible to be more detailed, because I don't understand how to use it, I am a novice! But thank you very much for answering my request.

 
ollpd писал(а) >>

...could you elaborate on...

1. The isCloseLastPosByStop() function returns true (True), if the last closed position was closed by StopLoss.

2. Condition if (isCloseLastPosByStop()) checks if the last closed position was closed by StopLoss.

If the above condition is true, then init() function is called.

Reason: