Dear All,
I am a newbee to proReal and your kind help will be appreciated. As part of my practice, I am trying to develop a a simple strategy using a custom indicator I have developed.
defparam cumulateorders = false
//Mahwe Money Management
Capital = 1000
Risk = 0.01
StopLoss = 10
//Mahwe Calculate contracts
equity = Capital + StrategyProfit
maxrisk = round(equity*Risk)
PositionSize = abs(round((maxrisk/StopLoss)/PointValue)*pipsize)
mySTRONGBUY, myBUY, mySTRONGSELL, mySELL, myNeutral = CALL “#pivotPointAvg”(close)
Condition1 = CALL “#pivotPointAvg”(close)
IF Condition1 = mySTRONGBUY OR myBUY THEN
BUY PositionSize Share AT MARKET
ENDIF
IF LONGONMARKET AND Condition1 = myNeutral THEN
SELL PositionSize share AT MARKET
ENDIF
IF Condition1 = mySTRONGSELL OR mySELL THEN
SELLSHORT PositionSize share AT MARKET
ENDIF
IF SHORTONMARKET AND Condition1 = myNeutral THEN
EXITSHORT AT MARKET
ENDIF
However I am getting the below screen error:
Syntax error: The function “#pivotPointAvg” called from “AlgoTrading” returns 5 values but your code needs 1.
I want my strategy to choose only 1 value from the 5 values generated by my custom indicator so that my Buyor sell condition is triggered – can you kindly direct me where I am getting it wrong?
Happy trading to all!
Thanks
@Widzo
Always use the ‘Insert PRT Code’ button when putting code in your posts to make it easier for others to read.
Thank you 🙂
@GraHal
What should be deleted?
The error refers to line 14, you need to use a variable for ALL returned values, if you don’t need sone use the keyword ignored instead of a name.
Like in line 13.
If you search the forum for CALL you will find the official description and many examples on how indicators are CALLed.
What should be deleted?
My message. Thank you.
I jumped in and mentioned use of ‘ignored’, but then I read his code and saw that he uses all the returned values in his strategy.
@Widzo below is one of the links to what Roberto is referring.
CALL
Thank you so much @GraHal and @robertogozzi for your help! let me follow through your recommendation.
I think Roberto has sorted your code to make it work?
I wanted to run your Algo, but I do not have the Indicator … #pivotPointAvg”(close) … is it available on the PRC website or might you share it please?