Problems with Candlesticks with Output Variable Returns  [SOLVED]

Questions about MultiCharts and user contributed studies.
JayMTF
Posts: 10
Joined: 13 Dec 2014
Has thanked: 6 times

Problems with Candlesticks with Output Variable Returns

Postby JayMTF » 01 May 2015

HI,

I've got an autotrade program I'm trying to improve by adding candlesticks.

Doji candlestick patterns work fine - no issues. But when I use any pattern that has an Output Variable return, I get an error message. Even if it's exactly copy and pasted from the TS Functions and Reserve Words pdf.

Ex 1:

Value1 = C_BullEng_BearEng(14, oBullishEngulfing, oBearishEngulfing) ;

Error Msg with 'oBearishEngulfing' Highlighted in blue:

------ Compiled with error(s): ------
is not recognized
line 1, column 50

Ex 2:

Value1 = C_Hammer_HangingMan(14, 2, oHammer, oHangingMan) ;

Error Msg with 'oHammer' highlighted in blue:
------ Compiled with error(s): ------
is not recognized
line 1, column 36

I'm using MC64 for TWS.

Any ideas? or Recommendations?

Thanks in advance,

Jason

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Problems with Candlesticks with Output Variable Returns

Postby TJ » 01 May 2015

HI,

I've got an autotrade program I'm trying to improve by adding candlesticks.

Doji candlestick patterns work fine - no issues. But when I use any pattern that has an Output Variable return, I get an error message. Even if it's exactly copy and pasted from the TS Functions and Reserve Words pdf.

Ex 1:

Value1 = C_BullEng_BearEng(14, oBullishEngulfing, oBearishEngulfing) ;

Error Msg with 'oBearishEngulfing' Highlighted in blue:

------ Compiled with error(s): ------
is not recognized
line 1, column 50

Ex 2:

Value1 = C_Hammer_HangingMan(14, 2, oHammer, oHangingMan) ;

Error Msg with 'oHammer' highlighted in blue:
------ Compiled with error(s): ------
is not recognized
line 1, column 36

I'm using MC64 for TWS.

Any ideas? or Recommendations?

Thanks in advance,

Jason
You have to post more codes to make it sensible.

Have you defined your variables?

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: Problems with Candlesticks with Output Variable Returns  [SOLVED]

Postby JoshM » 02 May 2015

I've got an autotrade program I'm trying to improve by adding candlesticks.

Doji candlestick patterns work fine - no issues. But when I use any pattern that has an Output Variable return, I get an error message. Even if it's exactly copy and pasted from the TS Functions and Reserve Words pdf.

(...)

Any ideas? or Recommendations?
It works fine here after defining the variables:

Code: Select all

Variables:
oBullishEngulfing(0),
oBearishEngulfing(0),
oHammer(0),
oHangingMan(0);

Value1 = C_BullEng_BearEng(14, oBullishEngulfing, oBearishEngulfing);

Value2 = C_Hammer_HangingMan(14, 2, oHammer, oHangingMan);
These variables need to be created (with `Variables:`) before being passed into the candlestick function here because these function arguments are `NumericSimpleRef` variables:

Image

That `NumericSimpleRef` means these variables are passed as reference into the function (see here for more for what that means).

In other words, a variable needs to be provided to the candlestick function so that it can store a value into that variable (as a way of outputting data from the function). Without such variable, there's an error when compiling.
Attachments
scr.02-05-2015 17.27.29.png
(3.73 KiB) Downloaded 684 times

JayMTF
Posts: 10
Joined: 13 Dec 2014
Has thanked: 6 times

Re: Problems with Candlesticks with Output Variable Returns

Postby JayMTF » 02 May 2015

JoshM you nailed it. That was it. Thank you, I just spent the past 4.5 hrs improving my strategy. Thank you very much.

I figured since I didn't have to declare the doji or shooting star as a variable, I could just do the same with Output Variable Returns, clearly there's still a lot to learn :)

Thanks,

Jason


Return to “MultiCharts”