English

## help with an EA

 2 arkan1976_6 2016.10.01 23:36   hello all, please,  It is possible to modify this code to Buy_TP and Sell_TP be equal to the opening price of the current candle?Thanks.CODE: [SELECT ALL] extern double Buy_TP=1.3000; //Here be open price current candleextern double Buy_SL=0;extern double Sell_TP=1.3000; //Here be open price current candleextern double Sell_SL=0;//+------------------------------------------------------------------+//| expert initialization function |//+------------------------------------------------------------------+int init(){//---- //----return(0);}//+------------------------------------------------------------------+//| expert deinitialization function |//+------------------------------------------------------------------+int deinit(){//---- //----return(0);}//+------------------------------------------------------------------+//| expert start function |//+------------------------------------------------------------------+int start(){//----int HowDeepIsYourLove = OrdersTotal();double TP,SL;for(int z=0;z
13133
WHRoeder 2016.10.02 14:45 #

arkan1976_6  It is possible to modify this code to Buy_TP and Sell_TP be equal to the opening price of the current candle?
1.  Play video Please edit your post. For large amounts of code, attach it.

2. Of course it's possible.
learn to code it, or pay someone. We're not going to code it FOR you.
 2 arkan1976_6 2016.10.02 18:47 #   `thanks for answer.I tried this change, will be correct ? thanks````double price=iOpen(Symbol(),0,0); double Buy_TP=price; double Buy_SL=0; double Sell_TP=price; double Sell_SL=0; // + ----------------------------------------------- ------------------- + // | función de inicialización experto | // + ----------------------------------------------- ------------------- + int  init ( ) { // ---- // ---- retorno ( 0 ) ; } // + ----------------------------------------------- ------------------- + // | función deinicialización experto | // + ----------------------------------------------- ------------------- + int  deinit ( ) { // ---- // ---- retorno ( 0 ) ; } // + ----------------------------------------------- ------------------- + // | Función de arranque experto | // + ----------------------------------------------- ------------------- + int  inicio ( ) { // ---- int  HowDeepIsYourLove  =  OrdersTotal ( ) ; doble  TP, SL ; para ( int  z = 0 ; z < HowDeepIsYourLove ; z ++ )  { si ( OrderSelect ( z, SELECT_BY_POS , MODE_TRADES ) )  { si ( OrderType ( ) == OP_BUY || OrderType ( ) == OP_BUYSTOP || OrderType ( ) == OP_BUYLIMIT )  { TP = NormalizeDouble ( Buy_TP, Dígitos ) ; SL = NormalizeDouble ( Buy_SL, Dígitos ) ; si ( OrderTakeProfit ( ) ! = TP || OrderStopLoss ( ) ! = SL )  { si ( ! OrderModify ( OrderTicket ( ) , OrderOpenPrice ( ) , SL, TP, 0 , CLR_NONE ) ) Imprimir ( "Algo pasó en BuyHood =), el error #" + GetLastError ( ) ) ; } }  Demás  si ( OrderType ( ) == OP_SELL || OrderType ( ) == OP_SELLSTOP || OrderType ( ) == OP_SELLLIMIT )  { TP = NormalizeDouble ( Sell_TP, Dígitos ) ; SL = NormalizeDouble ( Sell_SL, Dígitos ) ; si ( OrderTakeProfit ( ) ! = TP || OrderStopLoss ( ) ! = SL )  { si ( ! OrderModify ( OrderTicket ( ) , OrderOpenPrice ( ) , SL, TP, 0 , CLR_NONE ) ) Imprimir ( "Algo pasó en SellHood =), el error #" + GetLastError ( ) ) ; } } } } // ---- retorno ( 0 ) ; } // + ----------------------------------------------- ------------------- + ```