| View previous topic :: View next topic |
| Author |
Message |
Matt_mm
Joined: 07 Jun 2009 Posts: 17
|
Posted: Sat Nov 21, 2009 2:47 am Post subject: Is selecting history by position possible? |
|
|
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 |
|
 |
Terranin Site Admin

Joined: 21 Oct 2006 Posts: 831
|
Posted: Mon Nov 23, 2009 11:18 pm Post subject: Re: Is selecting history by position possible? |
|
|
| 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 |
|
 |
|
|
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
|