|
5 registered members (AndrewAMD, SBGuy, Petra, flink, 1 invisible),
699
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
enterTrade() with TMF
#485796
04/21/22 16:21
04/21/22 16:21
|
Joined: May 2018
Posts: 134
SBGuy
OP
Member
|
OP
Member
Joined: May 2018
Posts: 134
|
Hi, trying to use enterTrade() with a TMF for the first time. https://zorro-project.com/manual/en/buylong.htmIf the TMF function name is assignedTMF(), do I simply make T.manage = (void *) assignedTMF() like below? It compiles without any errors. Thanks!
TRADE T; memset(&T,0,sizeof(T));
T.tEntryDate = wdate(0);
T.flags = TR_OPEN|TR_LONG;
strcpy(T.Skill,Asset); // Asset
T.nID = 1000000+TradeID;
T.nLots = TradeLots*Multiplier;
T.fStopLimit = Stop;
T.fTrailLimit = Trail;
T.fEntryPrice = TradeUnderlying;
T.manage = (void *) assignedTMF();
enterTrade(&T);
Last edited by SBGuy; 04/21/22 16:24.
|
|
|
Re: enterTrade() with TMF
[Re: SBGuy]
#485862
04/30/22 18:02
04/30/22 18:02
|
Joined: May 2018
Posts: 134
SBGuy
OP
Member
|
OP
Member
Joined: May 2018
Posts: 134
|
Any idea, how I might add a trailing stop when using enterTrade? Setting Stop and Trail before enterTrade() appears to have no effect. Manually settting T.fStopLimit = TradeUnderlying-Stop works for a single stop. But I can't seem to get a trailing stop to work.
Stop = 0.10*priceClose(0);
Trail = 0.20*Stop;
TRADE T; memset(&T,0,sizeof(T));
T.tEntryDate = wdate(0);
T.flags = TR_OPEN|TR_LONG;
strcpy(T.Skill,Asset); // Asset
T.nID = 1000000+TradeID;
T.nLots = Lots;
T.fStopLimit = priceClose(0)-Stop;
// T.fStopDiff = -1*Stop;
//T.fTrailDiff = -1*Trail;
T.fEntryPrice = priceClose(0);
TRADE* p = enterTrade(&T);
if (p) {
p->manage = (void *) assignedTMF;
}
|
|
|
|
|
|