Porting Code from 10.3v to 11.1v

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #151735 quote
    ashehzi
    Participant
    Average

    Hi,

    I have started using version 11.1 (thanks to Ale mentioning to me) on IG Demo account. I am migrating my code from production 10.3v to demo account so that when 11.1 goes to live on IG, i shall be able to take advantage of it.

    I’ve been able to import all of my indicators without any issue.

    All indicators are working except one. The code is OK, there is no error, it works fine on 10.3 but somehow not showing results on 11.1 while same shows results on 10.3 on same time frame and instrument (stock/index).

    There is no error in the code. It saves and gets added without any syntax error. What could be the issue?

    #151736 quote
    Nicolas
    Keymaster
    Master

    Difficult to know exactly why without the code.

    But try to embed your indicator’s code into a test about sufficient barindex. If your indicator is using periods, use the biggest one in the test:

    if barindex > biggestPeriod then 
     //your indicator code 
    endif 
    
    RETURN var1, var2 //return line is outside the test
    #151741 quote
    ashehzi
    Participant
    Average

    Hi,

    I am using e.g.

    DEFPARAM CalculateOnLastBars = 1000
    
    hEst = highest[highLen](close)
    lEst = lowest[lowLen](close)

     

    where highLen and lowLen are passed as input variables (e.g. highLen=5 and lowLen=5)

    I will try adding yours also.

    #151745 quote
    ashehzi
    Participant
    Average

    I did like below:

     

    DEFPARAM CalculateOnLastBars = 1000
    
    alpha = 255
    longConditions = 0
    shortConditions = 0
    
    r= 75//75
    g= 75//75
    b= 75//75
    
    if barindex > 1000 then
    
    <rest of my code here>
    
    endif
    
    return myvar1, myvar2

     

     

    No errors but no results.

    #151759 quote
    Nicolas
    Keymaster
    Master

    Please use the button to insert code into your message.

    The code is working ok for me, see attached picture.

    indicator-v11-working-fine.png indicator-v11-working-fine.png
    #151772 quote
    ashehzi
    Participant
    Average

    Thanks Nicola for your quick responses. I will go to old (my rubbish) way of debugging the code i.e. add lines one by one and see the reaction.

    #151774 quote
    ashehzi
    Participant
    Average

    Hi,

    I found the issue. I will highlight here as it would be useful to others.

     

    PRT 10.3v

    =======

    // e.g. for dax
    myValue = 13033
    Condition1 = 1
    Condition2 = 1
    
    if (close[1] = myValue AND Condition1 AND Condition2) then
    <do something>
    endif
    
    // Above myValue AND Condition1 AND Condition2 meant 13033

    PRT 11

    =====

    // e.g. for dax
    myValue = 13033
    Condition1 = 1
    Condition2 = 1
    
    if (close[1] = myValue AND Condition1 AND Condition2) then
    <do something>
    endif
    
    // Above myValue AND Condition1 AND Condition2 meant 1

    So I did like this then

    // e.g. for dax
    myValue = 13033
    Condition1 = 1
    Condition2 = 1
    
    if (Condition1 AND Condition2) then
    if (close[1] = myValue) then
    <do something>
    endif
    endif
    
    // Above myValue AND Condition1 AND Condition2 meant 13033
    #151775 quote
    ashehzi
    Participant
    Average

    ignore

    #151871 quote
    Nicolas
    Keymaster
    Master

    Sorry I don’t get it, in any case, this code:

    (close[1] = myValue AND Condition1 AND Condition2)

    is a boolean expression and will return 0 (false) or 1 (true).

    #152950 quote
    ashehzi
    Participant
    Average

    Yes that is a boolean expression but condition wasn’t getting true in v11 as shown in above example. So I modified code in v11 as stated above.

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

Porting Code from 10.3v to 11.1v


Platform Support: Charts, Data & Broker Setup

New Reply
Author
author-avatar
ashehzi @ashehzi Participant
Summary

This topic contains 9 replies,
has 2 voices, and was last updated by ashehzi
5 years, 2 months ago.

Topic Details
Forum: Platform Support: Charts, Data & Broker Setup
Language: English
Started: 11/26/2020
Status: Active
Attachments: 1 files
Logo Logo
Loading...