|
|
Short trade not entered?
#428517
08/29/13 04:45
08/29/13 04:45
|
Joined: Jun 2013
Posts: 1,609
DdlV
OP
Serious User
|
OP
Serious User
Joined: Jun 2013
Posts: 1,609
|
Hi. Probably another late-night blindness, but can someone tell me why the Short trade isn't entered in this simple script?
function tmf() {
for(open_trades) {
}
return 0;
}
function run() {
set(HEDGING);
set(LOGFILE);
set(PARAMETERS);
set(PLOTNOW);
set(PLOTPRICE);
set(TICKS);
BarPeriod = 240;
StartDate = 20130101;
EndDate = 20130331;
if(NumOpenTotal==0) {
enterLong(tmf);
enterShort(tmf);
}
}
If I comment out the empty for(open_trades) loop in the TMF, the Short trade is entered... Thanks.
|
|
|
Re: Short trade not entered?
[Re: DdlV]
#428528
08/29/13 10:34
08/29/13 10:34
|
Joined: Jul 2000
Posts: 27,935 Frankfurt
jcl

Chief Engineer
|

Chief Engineer
Joined: Jul 2000
Posts: 27,935
Frankfurt
|
Trade management functions run at every tick and are bound to their trade, which implies some restrictions. Data series can not be created in a TMF, and indicators creating data series can not be called. A TMF should only handle its own trade: it must not contain trade enumeration loops or access other trades, but it can open new trades with enterLong/Short (Zorro 1.16 and above). The current candle is incomplete, so its range and height is normally smaller than the other candles; the last full candle has the index 1. The price functions can be called, but their open, high, or low prices do not reflect a full candle, but are in relation to the bar begin. Use TradePriceOpen or TradePriceClose for getting the current price of the asset. Trade enumeration loops and TMFs both change the ThisTrade pointer, so they are mutually exclusive - combining them makes not much sense anyway.
|
|
|
Re: Short trade not entered?
[Re: jcl]
#428615
08/30/13 16:02
08/30/13 16:02
|
Joined: Nov 2012
Posts: 126
blaub4r
Member
|
Member
Joined: Nov 2012
Posts: 126
|
Trade management functions run at every tick and are bound to their trade, which implies some restrictions. Data series can not be created in a TMF, and indicators creating data series can not be called. A TMF should only handle its own trade: it must not contain trade enumeration loops or access other trades, but it can open new trades with enterLong/Short (Zorro 1.16 and above). The current candle is incomplete, so its range and height is normally smaller than the other candles; the last full candle has the index 1. The price functions can be called, but their open, high, or low prices do not reflect a full candle, but are in relation to the bar begin. Use TradePriceOpen or TradePriceClose for getting the current price of the asset. Zorro 1.16? Is this a typo or is 1.16 currently in beta test?
|
|
|
|