Forex Tester Forum (Professional Training Software for Traders) Forum Index Forex Tester Forum (Professional Training Software for Traders)

Back to main site   Risk disclosure
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Is selecting history by position possible?

 
Post new topic   Reply to topic    Forex Tester Forum (Professional Training Software for Traders) Forum Index -> FT API
View previous topic :: View next topic  
Author Message
Matt_mm



Joined: 07 Jun 2009
Posts: 17

PostPosted: Sat Nov 21, 2009 2:47 am    Post subject: Is selecting history by position possible? Reply with quote

I've been using the select_by_pos for mode_history to assign the magic number from the most recently closed trade to a variable. This doesn't seem to work so I'm wondering if it's possible to select history by position (because the variable once initially set doesn't change) or if my code is wrong:

Code:
if OrderSelect(0, SELECT_BY_POS, MODE_HISTORY) then
    begin
      if (OrderMagicNumber <> tempOrder) then
      begin
        tempOrder:= OrderMagicNumber;


I try to incriment magic number when opening new orders so every order is different:
Code:
SendInstantOrder(Symbol, op_Buy, PositionSize, StopPrice, ProfitPrice, '', TempMagicNumber, OrderNumber);
        TempMagicNumber := TempMagicNumber + 1;


Once the code initially sets tempOrder the value of the variable doesn't change, any suggestions?
Back to top
View user's profile Send private message
Terranin
Site Admin


Joined: 21 Oct 2006
Posts: 831

PostPosted: Mon Nov 23, 2009 11:18 pm    Post subject: Re: Is selecting history by position possible? Reply with quote

Matt_mm wrote:
I've been using the select_by_pos for mode_history to assign the magic number from the most recently closed trade to a variable. This doesn't seem to work so I'm wondering if it's possible to select history by position (because the variable once initially set doesn't change) or if my code is wrong:

Code:
if OrderSelect(0, SELECT_BY_POS, MODE_HISTORY) then
    begin
      if (OrderMagicNumber <> tempOrder) then
      begin
        tempOrder:= OrderMagicNumber;


I try to incriment magic number when opening new orders so every order is different:
Code:
SendInstantOrder(Symbol, op_Buy, PositionSize, StopPrice, ProfitPrice, '', TempMagicNumber, OrderNumber);
        TempMagicNumber := TempMagicNumber + 1;


Once the code initially sets tempOrder the value of the variable doesn't change, any suggestions?


Well, but you always select 0 position in history, how can MagicNumber change there? At least try to go through all orders in history.

_________________
Hasta la vista
Mike
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Forex Tester Forum (Professional Training Software for Traders) Forum Index -> FT API All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group