Custom Indicator Error in Strategy

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #146980 quote
    Widzo
    Participant
    Junior

    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

    #147002 quote
    robertogozzi
    Moderator
    Master

    @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?

    #147003 quote
    robertogozzi
    Moderator
    Master

    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.

    #147011 quote
    GraHal
    Participant
    Master

    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.

    #147012 quote
    GraHal
    Participant
    Master

    @Widzo  below is one of the links to what Roberto is referring.

    CALL

    #147014 quote
    Widzo
    Participant
    Junior

    Thank you so much @GraHal and @robertogozzi for your help! let me follow through your recommendation.

    #147041 quote
    GraHal
    Participant
    Master

    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?

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.

Custom Indicator Error in Strategy


General Trading: Market Analysis & Manual Trading

New Reply
Author
author-avatar
Widzo @widzo Participant
Summary

This topic contains 6 replies,
has 3 voices, and was last updated by GraHal
5 years, 5 months ago.

Topic Details
Forum: General Trading: Market Analysis & Manual Trading
Language: English
Started: 10/10/2020
Status: Active
Attachments: No files
Logo Logo
Loading...