Assigning a custom trade ID?

Posted By: Hredot

Assigning a custom trade ID? - 09/16/17 22:31

When testing my scripts with a simple reversal algorithm, I notice that out of 1400 trades roughly 50 duplicate IDs appear (Zorro 1.60).
Clearly there is some bug in the ID generator. Is there a way to assign user defined IDs to the trades? I did not see any way to pass an ID to the EnterLong or EnterShort routines.
Posted By: pascalx

Re: Assigning a custom trade ID? - 09/17/17 17:14

Hi. What do you need the ID for tho?

trading.h

Quote:

typedef struct TRADE
{
int nID; // active trade id, or 0 for pending trades; can change when trades are partially closed
// ...
}


I don't know what happens if you overwrite it. Maybe undefined behaviour.
Posted By: AndrewAMD

Re: Assigning a custom trade ID? - 09/17/17 18:32

Originally Posted By: Hredot
When testing my scripts with a simple reversal algorithm, I notice that out of 1400 trades roughly 50 duplicate IDs appear (Zorro 1.60).
Clearly there is some bug in the ID generator. Is there a way to assign user defined IDs to the trades? I did not see any way to pass an ID to the EnterLong or EnterShort routines.
Trade ID's are defined in the Broker plugin. They either relay an actual trade number or use a counter. Who's your broker?
Posted By: Hredot

Re: Assigning a custom trade ID? - 09/17/17 18:42

Oh I see, I was using the IB demo setting.
Thank you for the explanation!
I guess identical ids only appear consecutively, non-overlapping, so it is not an issue actually.
© 2024 lite-C Forums