Page 1 of 1

Trading Blox Custom Indicator

Posted: Tue Jan 26, 2010 7:41 pm
by Jez Liberty
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.high + instrument.low + instrument.close))/4, shortParam) - Average(( + 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.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:

Posted: Tue Jan 26, 2010 8:18 pm
by Tim Arnold
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.

Posted: Wed Jan 27, 2010 5:56 pm
by Jez Liberty
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).


Posted: Thu May 27, 2010 4:33 pm
by mlvn23
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?

Posted: Thu May 27, 2010 5:29 pm
by Tim Arnold
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.

Posted: Sat May 29, 2010 12:02 am
by mlvn23
Thanks, Tim. It appears that the Auxiliary blox gets executed first top to bottom, and then the Entry / Exit blox.