SendInstantOrder - is there an issue with comments?

Bug reports and errors in the program
Message
Author
oublette
Posts: 4
Joined: Wed Jan 11, 2017 9:09 am

SendInstantOrder - is there an issue with comments?

#1 Postby oublette » Wed Jan 11, 2017 10:12 am

Hi I hope you can help me,

I'm using FT3 and trying to create an automated strategy to test. This is my first attempt at strategy building for FT.

I seem to have no problem creating an instant order using the following code using the C++ API:

Code: Select all

if (SendInstantOrder(Currency, op_Buy, 0.1, 0, 0, "TestComment", 0, i_OrderHandle)) {
    // get the entry price for the trade
    TTradePosition info;
    if (GetOrderInfo(i_OrderHandle, info) == true) {
        // set the stop loss
   ModifyOrder(i_OrderHandle, info.OpenPrice, (info.OpenPrice - (d_ATR * 3)), 0);
    }
}

.... but.. the comment is not attached to the order and the comment field in the Account History window is empty.

Has any one seen this issue before and can make a suggestion on how to fix it? Is this same issue seen with the Delphi API? Am I doing something wrong here in setting the comment and if any one has some example code of how to do this correctly I would very much appreciate it. The information I can see in the API guide would make me think I am doing this correctly.

Many thanks in advance.

oublette
Posts: 4
Joined: Wed Jan 11, 2017 9:09 am

Re: SendInstantOrder - is there an issue with comments?

#2 Postby oublette » Thu Jan 12, 2017 1:34 pm

To add some more detail to this.... It looks like the issue is not with the SendInstantOrder function, but with the ModifyOrder function.

Creating this order in this manner:

Code: Select all

double stop_loss;
if (order_type == op_Buy) {
   stop_loss = Bid() - (atr * 3);
} else {
   stop_loss = Bid() + (atr * 3);
}
SendInstantOrder(Currency, order_type, 0.1, stop_loss, 0, comment, 0, order_handle);

Creates the order and attaches the Comment to the order correctly.. but when I then modify the order, the comment is lost. This is demonstrated by the code below:

Code: Select all

if (OrderClosed(first_order_handle) == false) {
   if (trade_type == op_Buy) {
      if (Bid() > second_entry_level) {
         if (OrderClosed(second_order_handle) == true) {
            SendInstantOrder(Currency, op_Buy, 0.1, Bid() - (atr * 3), 0, comment, 0, second_order_handle);
         }
      }
   }
   else if (trade_type == op_Sell) {
      if (Bid() < second_entry_level) {
         if (OrderClosed(second_order_handle) == true) {
            SendInstantOrder(Currency, op_Sell, 0.1, Bid() + (atr * 3), 0, comment, 0, second_order_handle);
            OrderSelect(second_order_handle, SELECT_BY_TICKET, MODE_TRADES);
            ModifyOrder(second_order_handle, OrderOpenPrice(),0, 0);
         }
      }
   }
}

In this example. Creating the buy entry and the sell entry are both created the same. I see the comment in the Buy entry, but the sell entry has no comment. This is because of the extra ModifyOrder call.

I'm also going to log this in the bug forums (I'm not even sure how active this forum is)..... but...

If anyone could suggest a fix or workaround for this bug I would very much appreciate it, I'd hate to have the comment field be useless to me in a strategy where I need to programmaticly trail stops.

Many thanks in advance,

Oublette.

FX Helper
Posts: 827
Joined: Mon Apr 01, 2013 3:55 am

Re: SendInstantOrder - is there an issue with comments?

#3 Postby FX Helper » Fri Jan 13, 2017 5:02 am

Hello,

Sorry, but ModifyOrder() function doesn't have an option to set comments, that's why this function erases comment from the order.

I've already asked our programmers to add this option in the next version of API, hope this will be done soon.

oublette
Posts: 4
Joined: Wed Jan 11, 2017 9:09 am

Re: SendInstantOrder - is there an issue with comments?

#4 Postby oublette » Fri Jan 13, 2017 7:42 am

Thanks for the confirmation FX Helper.

It would be nice if ModifyOrder as it stands at the minute simply didn't erase the comment. I don't actually want to change it at all. I would just like the original order comment to persist when I say, modify the StopLoss.

My assumption would be that this occurs in FT itself rather than in API. Again my assumption would be that the function inside FT which the API calls is clearing out the comment.

Many thanks for the update!

Oublette.


Return to “Bug reports”

Who is online

Users browsing this forum: No registered users and 1 guest