Libraries: TradeAlgorithms

 

TradeAlgorithms:

Trade functions library designed for use in the code of scripts and Expert Advisors depending on a broker

Author: Nikolay Kositsin

 

Regarding:

//| Trade algorithms for brokers who offer nonzero spread and        |
//| and stops setting after opening a position! 

 in your code where you setup the request to modify a Buy . . .

 

bool BuyPositionModify
.
.
.

//---- initializing structure of the MqlTradeRequest to open BUY position
   request.type   = ORDER_TYPE_BUY;
   request.price  = Ask;
   request.action = TRADE_ACTION_SLTP;
   request.symbol = symbol;

//---- Determine distance to Stop Loss (in price chart units)
   if(StopLoss)
     {
      if(!StopCorrect(symbol,StopLoss))return(false);
      double dStopLoss=StopLoss*point;
      request.sl=NormalizeDouble(request.price-dStopLoss,digit);
      if(request.sl<PositionGetDouble(POSITION_SL)) request.sl=PositionGetDouble(POSITION_SL);
     }
   else request.sl=PositionGetDouble(POSITION_SL);

//---- Determine distance to Take Profit (in price chart units)
   if(Takeprofit)
     {
      if(!StopCorrect(symbol,Takeprofit))return(false);
      double dTakeprofit=Takeprofit*point;
      request.tp=NormalizeDouble(request.price+dTakeprofit,digit);
      if(request.tp<PositionGetDouble(POSITION_TP)) request.tp=PositionGetDouble(POSITION_TP);
     }
   else request.tp=PositionGetDouble(POSITION_TP);

 you set  the type, price, action, symbol, sl and tp.  The documentation states that only the action, symbol, tp and sl  are required,  why do you also setup type and price ?  have you found that the documentation is incorrect ?

 
Automated-Trading:

TradeAlgorithms:

Author: Nikolay Kositsin

Hello friends,

I'm adapting a forex EA that uses this library for use on BMF&Bovespa. I'm not sure which variant to use. Although there is a spread on the Bovespa, it has a different meaning from the forex spread. I believe that the correct variant for BMF&Bovespa is 1. Can anyone confirm this?

Abs,

Mr Biegler
 

i've tried to put trailing stop using WPR or Parabolic, unfortunately still failed

would you mind to give an example how to put the trailing stops for frasmav2

thanks a lot 

 
None of the four variants of the library does not work=(((( gives a message in the log - Invalid volume for the structure of the trade request (at any volume settings) - I think the reason is that on my terminal the volume of purchases on currency pairs such - 100000-lot, 10000- 0.1lot, 1000-0.01lot - in general everything is not like people=((((( I tried on another broker on another platform and even on another computer - there lot input is normal - that is 1, 0.1, 0.01 - there everything works - I have been poking into this code for almost a week - I can not find what to fix that it counts lots in thousands=((((( please advise or if you do not mind throwing the version for the broker with lots in thousands - thank you in advance.
 
Otavio Konmin Clemente:
Hello friends,

I'm adapting a forex EA that uses this library for use on the BMF&Bovespa. I'm not sure which variant to use. Although there is a spread on the Bovespa, it has a different meaning to the forex spread. I believe that the correct variant for BMF&Bovespa is 1. Can anyone confirm this?

Abs,

Otávio

Otávio, your statement is correct. It is option 1.

 

In my case:

Invalid data for trade request structure!

OrderCheck(): Unsupported type of order execution by balance is specified

I tried all 4 options too) The values of request.type, request.price, request.action, etc. seem to be correct.

 
Paulo Campozana:

Otávio, your statement is correct. It's option 1.

Good evening, Paulo. I'm trying to use this karacatica robot, but I have a question. In which folder should I put the file for option 1? Can you help?

 
Gentlemen, I'm trying to use this robot, but in the tests it doesn't enter any position although it works. What could it be?
 
Hello,  I tried to stop the multiple entries but it failed I think its because of the recount command,  any assistant on that please.