robot without take profit and stop loss

 

Hello, i trying adapt this robot and, i don't can put take profit and stop loss in points. Look: i need put take and stop with 50 points, can you help me?

the code: 

#include <Trade/Trade.mqh> // biblioteca-padrão CTrade

input double lote = 0.5;

input int periodoCurta = 10;

input int periodoLonga = 50;

input int takeprofit = 30.0;

input int stoploss = 15.0;

//+------------------------------------------------------------------+

//| GLOBAIS                                                          |

//+------------------------------------------------------------------+

//--- manipuladores dos indicadores de média móvel

int curtaHandle = INVALID_HANDLE;

int longaHandle = INVALID_HANDLE;

//--- vetores de dados dos indicadores de média móvel

double mediaCurta[];

double mediaLonga[];

double ask,bid,last;

//--- declarara variável trade

CTrade trade;

MqlTick tick;

//+------------------------------------------------------------------+

//| Expert initialization function                                   |

//+------------------------------------------------------------------+

int OnInit()

  {

//---

   ArraySetAsSeries(mediaCurta,true);

   ArraySetAsSeries(mediaLonga,true);



//--- atribuir p/ os manupuladores de média móvel

   curtaHandle = iMA(_Symbol,_Period,periodoCurta,0,MODE_SMA,PRICE_CLOSE);

   longaHandle = iMA(_Symbol,_Period,periodoLonga,0,MODE_SMA,PRICE_CLOSE);

   

//---

   return(INIT_SUCCEEDED);

  }

//+------------------------------------------------------------------+

//| Expert deinitialization function                                 |

//+------------------------------------------------------------------+

void OnDeinit(const int reason)

  {

//---

   

  }

//+------------------------------------------------------------------+

//| Expert tick function                                             |

//+------------------------------------------------------------------+

void OnTick()

  {

  ask = SymbolInfoDouble(_Symbol, SYMBOL_ASK);

  bid = SymbolInfoDouble(_Symbol, SYMBOL_BID);

  last = SymbolInfoDouble(_Symbol, SYMBOL_LAST);

   if(isNewBar())

     {

      // execute a lógica operacional do robô

      

      //+------------------------------------------------------------------+

      //| OBTENÇÃO DOS DADOS                                               |

      //+------------------------------------------------------------------+

      int copied1 = CopyBuffer(curtaHandle,0,0,3,mediaCurta);

      int copied2 = CopyBuffer(longaHandle,0,0,3,mediaLonga);

      //---

      bool sinalCompra = false;

      bool sinalVenda = false;

      //--- se os dados tiverem sido copiados corretamente

      if(copied1==3 && copied2==3)

        {

         //--- sinal de compra

         if( mediaCurta[1]>mediaLonga[1] && mediaCurta[2]<mediaLonga[2] )

           {

            sinalCompra = true;

           }

         //--- sinal de venda

         if( mediaCurta[1]<mediaLonga[1] && mediaCurta[2]>mediaLonga[2] )

           {

            sinalVenda = true;

           }

        }

      

      //+------------------------------------------------------------------+

      //| VERIFICAR SE ESTOU POSICIONADO                                   |

      //+------------------------------------------------------------------+

      bool comprado = false;

      bool vendido = false;

      if(PositionSelect(_Symbol))

        {

         //--- se a posição for comprada

         if( PositionGetInteger(POSITION_TYPE)==POSITION_TYPE_BUY )

           {

            comprado = true;

           }

         //--- se a posição for vendida

         if( PositionGetInteger(POSITION_TYPE)==POSITION_TYPE_SELL )

           {

            vendido = true;

           }

        }

      

      //+------------------------------------------------------------------+

      //| LÓGICA DE ROTEAMENTO                                             |

      //+------------------------------------------------------------------+

      //--- ZERADO

      if( !comprado && !vendido )

        {

         //--- sinal de compra

         if( sinalCompra )

           {

            trade.Buy(lote,_Symbol,ask,ask-stoploss,ask+takeprofit,"Compra a mercado");

           }

         //--- sinal de venda

         if( sinalVenda )

           {

            trade.Sell(lote,_Symbol,bid,bid-stoploss,bid+takeprofit,"Venda a mercado");

            }

         }

      }

  }

//+------------------------------------------------------------------+

//|                                                                  |

//+------------------------------------------------------------------+

bool isNewBar()

  {

//--- memorize the time of opening of the last bar in the static variable

   static datetime last_time=0;

//--- current time

   datetime lastbar_time=(datetime)SeriesInfoInteger(Symbol(),Period(),SERIES_LASTBAR_DATE);



//--- if it is the first call of the function

   if(last_time==0)

     {

      //--- set the time and exit

      last_time=lastbar_time;

      return(false);

     }



//--- if the time differs

   if(last_time!=lastbar_time)

     {

      //--- memorize the time and return true

      last_time=lastbar_time;

      return(true);

     }

//--- if we passed to this line, then the bar is not new; return false

   return(false);

  }
 
w.s.g:

Hello, i trying adapt this robot and, i don't can put take profit and stop loss in points. Look: i need put take and stop with 50 points, can you help me?

the code: 

rephrase your question again you dont it to have take profit and stop loss but you want it to take profit and stop loss with 50 points ,this doesnt make sense 

 
Amos Tsopotsa #:

rephrase your question again you dont it to have take profit and stop loss but you want it to take profit and stop loss with 50 points ,this doesnt make sense

I want to make a profit of 50 points or a loss of 50 points, that's all.

 
w.s.g #:

I want to make a profit of 50 points or a loss of 50 points, that's all.

you can use freelnace services 

 
Amos Tsopotsa #:

you can use freelnace services 

great, thank you!