| -
tick subscription using ExtSubscribe: Is this limited to the instrument of the chart?
Hello,
I am having some issues with the proper set-up of tick and bar streams in a strategy.
I was looking into helper.lua to try to understand if there is some limitations. I am subscribing to tick streams in Prepare(): Code: ------------------------------------------------------------ Tick Stream Set-Up ---------------------------------------------------------------------
-------------------------- Streams for Price Ticks ------------------------------
ExtSubscribe(TickStreamID + AskStreamOffset, StrategyInstrument, "t1", false, "tick");
ExtSubscribe(TickStreamID + BidStreamOffset, StrategyInstrument, "t1", true, "tick"); Then in ExtUpdate() I try to subscribe to the bar streams of all time frames but the issue is that ExtUpdate() never appears to get called in the debugger.
Looking into ExtSubscribe the relevant lines are (since I do set StrategyInstrument which is not NIL, i.e. not the instrument of chart display): Code: sub.stream = core.host:execute("getHistory", id, instrument, period, 0, 0, bid);
sub.tick = (period == "t1");
sub.loaded = false;
sub.lastSerial = -1;
_gSubscription[id] = sub; What does sub.tick = (period == "t1");
mean? Is there a limitation that tick streams have to have NIL as a parameter of ExtSubscribe?
Thanks,
Martin
-
One more question to tick streams: Does the index of [NOW] like in instance.ask[NOW] always return the latest tick price of the ask stream, or do I have to reference with 'period' in ExtUpdate() to reference the last tick?
I saw [NOW] many times in examples.
Thanks,
Martin
-
The index [NOW] in instance.ask[NOW] returns the latest tick price of the ask stream.
It is equivalent to: Code: instance.ask[instance.ask:size() - 1] -
Thanks, Natalya.
Could you also please tell me about the tick subscription. I changed the subscription to NIL as for the instrument, which appears to work fine. I can design like this, but I would like to know if it is posssible to use tick suscriptions with other instruments as well, in particular if this is possible and whether it does load then a certain history range of the tick stream of the instrument subscribed to.
Thanks,
Martin
-
 Originally Posted by mstreck ... I would like to know if it is posssible to use tick suscriptions with other instruments as well... Yes, you can use subscribe to any instrument ticks.
ExtSubscribe(1, nil, "t1", "Bid", "close");
is the same as
ExtSubscribe(1, [instrument of the strategy], "t1", "Bid", "close");  Originally Posted by mstreck ...whether it does load then a certain history range of the tick stream of the instrument subscribed to. Yes, it will load default number of ticks from the history. (In case of instrument == nil there is no need to load tick history. It is already loaded in the instance.bid/instance.ask).
-
That is great, thank you for your help.
Cheers,
Martin
|