How to use ArraySort and unset?

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #186254 quote
    CKW
    Participant
    Veteran

    Hi,

    I have an issue with “ArraySort($MAArray, ASCEND)” in Pro order.

    The same with Unset, the way I code is not correct?  Please advise.

    e.g.

    $MAArray[1] = DMAS20
    $MAArray[2] = DMAS50
    $MAArray[3] = DMAS200
    
    ArraySort($MAArray, ASCEND)

    br

    CKW

    Capture-1.jpg Capture-1.jpg
    #186256 quote
    robertogozzi
    Moderator
    Master

    Rewrite those few lines trying not to type unsupported characters.
    If the error is still reported, then it’s an error in one of the lines prior to 248.

    #186260 quote
    PeterSt
    Participant
    Master

    @CKW, if that is in ProOrder indeed (hence Strategy Code and not an Indicator) … both ArraySort and Unset are not supported there. You can see that by the syntax highlighting. So do you ?

     

    https://www.prorealcode.com/topic/array-variables-availability-in-prorealtime/page/12/#post-185587

    image_2022-01-22_102846.png image_2022-01-22_102846.png
    #186263 quote
    CKW
    Participant
    Veteran

    Hi PeterSt, Robertogozzi,

    Thanks.

    @CKW, if that is in ProOrder indeed (hence Strategy Code and not an Indicator) … both ArraySort and Unset are not supported there. You can see that by the syntax highlighting. So do you ?

    https://www.prorealcode.com/topic/array-variables-availability-in-prorealtime/page/12/#post-185587

    Thanks for telling that Pro order not support both ArraySort and unset :). There is no warning /error description saying that this syntax are not supporting.

    br

    CKW

    Capture-2.jpg Capture-2.jpg
    #186268 quote
    PeterSt
    Participant
    Master

    There is no warning /error description saying that this syntax are not supporting.

    Hmm …

    Paste this over the standard code in a new strategy :

    // Condities om long posities te openen
    Uwcondities = 1
    
    IF NOT LongOnMarket AND UwCondities THEN
    BUY 1 CONTRACTS AT MARKET
    ENDIF
    
    // Condities om long posities te sluiten
    If LongOnMarket AND UwCondities THEN
    SELL AT MARKET
    ENDIF
    
    // Condities om short posities te openen
    IF NOT ShortOnMarket AND UwCondities THEN
    SELLSHORT 1 CONTRACTS AT MARKET
    ENDIF
    
    // Condities om short posities te sluiten
    IF ShortOnMarket AND UwCondities THEN
    EXITSHORT AT MARKET
    ENDIF
    
    // Stops en targets : Voer uw beschermende stops en winst targets hier in
    
    $MAArray[1] = DMAS20
    $MAArray[2] = DMAS50
    $MAArray[3] = DMAS200
     
    ArraySort($MAArray, ASCEND)
    

    You should see that warning sign at the bottom line. If not, I wonder what could be going on.
    But watch out. The below code (see attached) shows the lines pasted from your post. And now the syntax error does *not* show, BUT it appears on line 1 you see there (I copied the line numbers from the code you showed).

    This makes Roberto’s remark correct in the first place because now indeed the message appears as with you. Btw hint : this is most probably about an If/Endif mismatch.
    But the ArraySort and Unset are still not supported … 🙁

    image_2022-01-22_113346.png image_2022-01-22_113346.png
    #186270 quote
    PeterSt
    Participant
    Master
    PS:

    $MAArray[1] = DMAS20

    Not that you asked for it, but notice that the first element of an array is [0] (not [1]).

    #186276 quote
    robertogozzi
    Moderator
    Master

    Not that you asked for it, but notice that the first element of an array is [0] (not [1]).

    I actually almost always start from element 1 (I count elements myself, I only occasionally use LASTSET).

    I prefer using element 0 to store say, the date I created it, or last modified it, or any other info I may need, sometimes assembling numbers to combine conditions, such as:

    – first digit (1=only for LONG trades, 2=only for SHORT trades, 9=all trades allowed, not 0 because it would be dropped, being the first digit)

    – second to seventh digit for the last time I modified/added any element

    – and more, provided it does not exceed the supported length (which I don’t know, maybe 12+ digits)

    – then 5 digits for the number of elements

    so it may contain  9 09300 00212 (which is for ALL trades, LAST modified at 9:30am, containing 212 elements, combined is 909300000212).

    Pepsmile thanked this post
    #186466 quote
    Nicolas
    Keymaster
    Master

    ArraySort and Unset instructions are about to be possible with IG accounts this week.

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

How to use ArraySort and unset?


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
CKW @ckw Participant
Summary

This topic contains 7 replies,
has 4 voices, and was last updated by Nicolas
4 years ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 01/22/2022
Status: Active
Attachments: 4 files
Logo Logo
Loading...