Trading Blox Custom Indicator

Questions and discussion of Trading Blox and other platforms for non Trading Blox customers. Trading Blox customers should use the Trading Blox Support forum.
Post Reply
Jez Liberty
Roundtable Knight
Roundtable Knight
Posts: 123
Joined: Tue Nov 03, 2009 8:49 am
Location: London
Contact:

Trading Blox Custom Indicator

Post by Jez Liberty » Tue Jan 26, 2010 7:41 pm

Not sure if this is the right place to post this but I dont have access to the customer forum... Sorry for any apologies.

I have just downloaded Trading Blox Trial version and started playing with it all night - using standard systems shipped with it - love the fact that it is so (blazing) fast and the way it presents the results. Looks very promising.

I then tried to play with the editor and update the MACD Portfolio Manager to create my own version: the MMDI portfolio Manager. Basically , instead of using the difference between 2 moving averages, the MMDI would use the difference between a short moving median and a long moving average - not sure if that makes sense, but its just an idea to play with the script editor.


I created a new Portfolio Manager block where I created my mmdiIndicator (Calculated) with Indicator Value Expression:

Median((instrument.open + instrument.high + instrument.low + instrument.close))/4, shortParam) - Average((instrument.open + instrument.high + instrument.low + instrument.close))/4, longParam)

however this did not work (seems like adding series together does not create a new series).

So, as per the help file, I created an Auxiliary block and in there created a System Scoped Auto-Indexed Instrument Permanent Variable (ohlcDiv4) of type Series. Then I assigned this value in the Update Indicators script with the formula:
ohlcDiv4 = (instrument.open + instrument.high + instrument.low + instrument.close) / 4

so far so good but when I go back to my MMDI Portfolio Manager and update my mmdiIndicator Value Expression to be:
Median(ohlcDiv4,mmdiShort) - Average(ohlcDiv4,mmdiLong)

the parser does not recognise ohlcDiv4 - even when I add ohlcDiv4 as a Block Instrument Permanent Value (with "defined Externally" option)


Would appreciate if any of you great Trading Blox developers can see something obvious or if I am completely missing something.. :oops:

Tim Arnold
Site Admin
Site Admin
Posts: 8501
Joined: Tue Apr 06, 2004 1:41 pm
Location: Boston, MA
Contact:

Post by Tim Arnold » Tue Jan 26, 2010 8:18 pm

One way do to this would be use use the OHLC/4 value in the MACD indicator, or create two exponential moving averages with the OHLC/4 value and subtract them.

Another way for more control would be to create a calculated indicator. The first two calculated indicators could be some custom value like HL/2 and the third would be the subtraction of the two.

For the most control, you can use Custom Indicators. The easiest way is to just add the Update Indicators script to your existing Entry Exit block. In this way you can create an IPV Auto Indexed Series, and assign the custom computation in the Update Indicators script.

If you create a separate Auxiliary block, then you need to set this IPV as System scoped, and then create an External defined IPV series of the same name in the entry exit block. This is a more advanced topic -- the scoping of variables.

Jez Liberty
Roundtable Knight
Roundtable Knight
Posts: 123
Joined: Tue Nov 03, 2009 8:49 am
Location: London
Contact:

Post by Jez Liberty » Wed Jan 27, 2010 5:56 pm

Tim,
Thanks for the answer - I see what you mean and I managed to implement something like what you described but using the Median instead of the EMA - I hadnt realised you can add scripts (ie like update Indicators) to any block (after a few trial and error - just have to get the hang of Trading Blox concepts..)

I ended up creating 2 indicators: emaIndicator and OHLCDiv4 and one IPV: mmdiIndicator which formula is: mmdiIndicator=Median(ohlcDiv4,mmdiShort)-emaIndicator (in the Update Indicators script that I added to my Portfolio Manager block).

Great!

mlvn23
Full Member
Full Member
Posts: 19
Joined: Mon Jan 25, 2010 1:19 am
Location: Fremont, CA

Post by mlvn23 » Thu May 27, 2010 4:33 pm

This is slightly different issue but fits the subject line.

If a system has BloxA and BloxB, both of which have "Update Indicator" scripts, but BloxA's "Update Indicator" script depends in BloxB's "Update Indicator" script (BloxB's output is an input to BloxA's script via a system variable).

How do TradingBlox handle this? Is there some static order in which the "Update Indicator" scripts are executed within the system?

Tim Arnold
Site Admin
Site Admin
Posts: 8501
Joined: Tue Apr 06, 2004 1:41 pm
Location: Boston, MA
Contact:

Post by Tim Arnold » Thu May 27, 2010 5:29 pm

Yes, there is a static order in which the blox are executed, and it's based on their order in the System Editor. You can verify the order of things quickly by putting PRINT statements in the code, such as to print the block name and script name in each script, to see which gets executed first and second.

mlvn23
Full Member
Full Member
Posts: 19
Joined: Mon Jan 25, 2010 1:19 am
Location: Fremont, CA

Post by mlvn23 » Sat May 29, 2010 12:02 am

Thanks, Tim. It appears that the Auxiliary blox gets executed first top to bottom, and then the Entry / Exit blox.

Post Reply