Scripts: OpenSellPosition

 

OpenSellPosition:

The script is developed for selling with fixed Stop Loss and Take Profit values in points from the current price.

Author: Nikolay Kositsin

 
Automated-Trading:

OpenSellPosition:

Author: Nikolay Kositsin

hi Nikolay

Was looking for a scrip like this great idea...tried using the scrip by attaching it to the chart but it immediately gets removed automatically fom the chart .

what do you think could be the problem 

 

 

Hello


Could you also make a "closeall" script wich will close all open positions ?


Thank yu

 
nonor:

Hello

Could you also make a "closeall" script wich will close all open positions ?

Thank yu

Hi nonor,

If you want to close a sell position, the you should open a buy position with the same lot and vice versa. 

Do this : on your MetaTrader 5, open sell some symbol - say 1 lot of EURUSD. To close it, open buy 1 lot of EURUSD..

 

 
onewithzachy:

Hi nonor,

If you want to close a sell position, the you should open a buy position with the same lot and vice versa. 

Do this : on your MetaTrader 5, open sell some symbol - say 1 lot of EURUSD. To close it, open buy 1 lot of EURUSD..

 

yes, but in mt4, I have a script wich I call by keys, Alt+c, and then positions are closed, it a kind of emergency close...
 
nonor:
yes, but in mt4, I have a script wich I call by keys, Alt+c, and then positions are closed, it a kind of emergency close...

Hi nonor,

Yep, I also have that in MT4 :D. However, MT4 is ticket based trading while MT5 is position base trading. I think close all can be applied in MT5 too, it just like I said before that's the way to close any open position in MT5 :(.

 


 
lion999:

hi Nikolay

Was looking for a scrip like this great idea...tried using the scrip by attaching it to the chart but it immediately gets removed automatically fom the chart .

what do you think could be the problem 

 

It didn't work for me so I got the debugger to find out that on my broker this was not working.  See the line I commented out?  Try that. Extrem_Stop was always coming back zero - could be a bug.
bool StopCorrect(string symbol,int &Stop)
  {
//----
   int Extrem_Stop=int(SymbolInfoInteger(symbol,SYMBOL_TRADE_STOPS_LEVEL));
   //if(!Extrem_Stop) return(false);
   if(Stop<Extrem_Stop) Stop=Extrem_Stop;
//----
   return(true);
  }
 

The orders are placed, but no StropLoss and Takeprofit are set.  I tryed to check the code, failing.

What's wrong in the code for not setting those parameters ?

thanks