Hi. I’m trying to figure out the CALL instruction from one indicator to Proorder. A simple test shows it works, but I encountered a syntax error here that I can’t figure out. Please help.
the Indicator and the code is. error is attached.
cheers Kasper
//Heikin-Ashi turning points
//Indicator
once t=1
once a0=(close)
once a1=(close)
once a2=(close)
once a3=(close)
if t=1 and close>a3 then
a0=a1
a1=a2
a2=a3
a3=close
elsif t=1 and close<a0 then
t=-1
a1=a3
a0=a3
a3=close
elsif t=-1 and close<a3 then
a0=a1
a1=a2
a2=a3
a3=close
elsif t=-1 and close>a0 then
t=1
a1=a3
a0=a3
a3=close
endif
cc = customclose
If cc crosses over a0 then
long=1
else
long=0
endif
if cc crosses under a0 then
short=-1
else
short=0
endif
Return Long COLOURED(255,0,0), short COLOURED(0,0,255)
// PROORDER:
// Conditions to enter long positions
mylong, myshort = call "Heikin-Ashi turning points"
IF NOT LongOnMarket AND mylong THEN
BUY 1 CONTRACTS AT MARKET
ENDIF
// Conditions to exit long positions
If LongOnMarket AND not mylong THEN
SELL AT MARKET
ENDIF
// Conditions to enter short positions
IF NOT ShortOnMarket AND myshort THEN
SELLSHORT 1 CONTRACTS AT MARKET
ENDIF
// Conditions to exit short positions
IF ShortOnMarket AND not myshort THEN
EXITSHORT AT MARKET
ENDIF
// Stops and targets : Enter your protection stops and profit targets here
Hi,
I think your CALL instruction in the first line in ProOrder wants to know what kind of close you want to call the indicator “Heikin-Ashi turning points” with, because in ProBuilder this indicator has a “custom close” inside it. So, if you want to call it using just a simple close for example, it would be:
mylong, myshort = call "Heikin-Ashi turning points"(close)
But if you want to call it using lows as customclose for example, rather than simple close, then it would be:
mylong, myshort = call "Heikin-Ashi turning points"(low)
I’d say that’s the missing expression in parenthesis the error message talks about: saying in parenthesis at the end of the line what kind of close you want.
Hi Noobywan
thanks very much for your quick respond:-) of cause now it’s obvious. Because there are two kind of close’s in the indicator. this code did it.
mylong, myshort = call "Heikin-Ashi turning points"(customclose)
I just updated the CALL instruction definition and examples in the documentation, FYI.
http://www.prorealcode.com/documentation/call/
LeoParticipant
Veteran
Hi all.
I use for the first time a Call functiin for my strategy.
When run it. It qrite the fuction at the bottom.
How exacly CALL works in an active strategy?
How does prorealtime knows when it starts the called indicator and the atrategy code?
I also try to use the indicator in a multiframe. At it doesnt work.
Thanks for replies.
I almost never used CALL because it made backtest slower and I preferred embedding the indicator within the code. Now things must have changed, because PRT was due to load any CALLed indicator together with a strategy, thus making it available as if it were written inline and it appears this improvement is working now, so CALLing an indicator from a strategy should be just like any function in all languages.
CALLing should be working in all TF’s, provided you CALL it from the TF you want and, if you CALL it from more than one TF you need to assign its returned values to variables named differently:
TIMEFRAME(Daily)
MAdaily = CALL "MyAverage"(200)
TIMEFRAME(4 hours)
MAh4 = CALL "MyAverage"(200)
TIMEFRAME(1 hours)
MAh1 = CALL "MyAverage"(200)
.
.
If you have a strategy CALLing an indicator open the trading panel with all strategies and their performances, click on the version of the strategy and you should see the embedded CALLed indicator.
I’ve seen it once I made a test.
I guess it wasn’t like that before!
Nicolas might be of help.
click on the version of the strategy and you should see the embedded CALLed indicator.
Oh yeah I’ve seen it loads and when backtesing a previously Forward Tested System (which I have copied back in the backtest screen) I have to rem out the Return line (or is that rem out the whole Indicator … I cant remember, even though I’ve done it dozens of times! 🙂 ) .
LeoParticipant
Veteran
I am not in my conputer at the moment .yesterday I tryin demo to open a strategy with thr neural network.
When the neural network shows the same predictions in differents time frame then it opens a trade. But… I got an error like “error number 37”. I think.
And then I see that probuilder copy the neural networ at the end of the code.
I just rename the output as you explain.
But rename every single variable of the neural network. It’s crazy
LeoParticipant
Veteran
Hi all.
I am try to use my neural network wiht a call function.
Now I wonder if prorealcode open the fuction every time load with DEFPARAM preloadbar and get the value.
Then it means that the neural network is only learning from data 10000 bar ago although, for example, the strategy is already running 20000 bars.
Can someone ( maybe from ProRealTime support) clarify more?
Thanks in advance