Simple hedge system.

 

Hello Dear forum Users!

I have a hedging system thats requires a little scripting. So for example when i place a sell stop, sell limit ( depend on the market direction) I would like to hedge them with a buy instant order exactly when the sell pending orders are activated. so just in canse when sell stop or sell limit activated. Buy instant order sould executed automaticly.

Is this even possible to be achived. Please if you can help me do not hesitate. Do not ask why I need this script, but its very important to my system.

Thank you very much.

 
everything is possible in this century
 
qjol:
everything is possible in this century
That isn't true . . . how would you build an Escalator to the Moon ? ;-)
 

is this a good start? its just a plan.

START;

if ( pending order = executed, maybe "== ture" :) ); // if pending order true, it is activated.

{

OrderSend(Symbol(), OP_SELLLIMIT ... ;

}

OrderSend(Symbol(), OP_BUY, lots ...; // then execute instant order automaticly

END;



It just a simple logical illustration, do not laugh please :P

 

You need to move your . . .

OrderSend(Symbol(), OP_BUY, lots ...; // then execute instant order automaticly

inside the braces {} in place of the Limit order . .

OrderSend(Symbol(), OP_SELLLIMIT ... ;
 
RaptorUK:

You need to move your . . .

inside the braces {} in place of the Limit order . .


Thank you RaptorUK !
 

I have worked with script that opens orders with horizontal line.

Here comes my question.

Is it possible to open instant buy or sell order, if price reaches or crosses the specific horizontal line?

I try to code it my question is, it is technically possible?

Thanks.

 
In detail, i would like to write a script that place a horizontal line. The script pick up the price of the horizontal line, when market reaches horizontal line it open an instant buy or sell.
 
apophissaw:
In detail, i would like to write a script that place a horizontal line. The script pick up the price of the horizontal line, when market reaches horizontal line it open an instant buy or sell.
Of course . . very easy but really you need an EA not a Script, you can get the information about the Horizontal Line using: https://docs.mql4.com/objects/ObjectGet and OBJPROP_PRICE1 https://docs.mql4.com/constants/objects/properties
 
Thanks again ! :)RaptorUK
 

Modification of a market order implies changing of the requested values of stop orders. You may not change open prices in market orders.

You cannot change the open price of a market order, since order opening is a fact. Therefore, there is no any programming method to do this. The only thing you can do with a market order is to close it. A market order can be closed as a result of the execution of a trade request formed by a trader or by a program, or if the market price reaches the requested price of one of stop orders.


Is this prevent me to making an EA that does the following? : the EA open a market sell and buy order at given horizontal line. So the EA checks if the price have reached the horizontal line prcie, and if its true the ea automaticly open a buy and a sell market order (hedge)