Inside bar code conversion

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #124448 quote
    MajorBasse
    Participant
    Average

    Hello!

    I am working on an inside bar strategy and I´ve found som exit criterias, but I believe the code is from MetaStock and I wonder if it is possible to convert it to PRT code?

    Here is the code:

    tr = 0.75

    si = 0.75

    else if marketposition = 1 then begin
    sell next bar at entryprice + entryprice*tr/100 limit;
    sell next bar at entryprice – entryprice*si/100 stop;
    end

    else if marketposition = -1 then begin
    buy to cover next bar at entryprice – entryprice*tr/100 limit;
    buy to cover next bar at entryprice + entryprice*si/100 stop;

    end

     

    If someone could convert this it would be greatly appreciated!

    #124483 quote
    Nicolas
    Keymaster
    Master

    I think that it could be converted this way:

    itr = 0.75
    si = 0.75
    
    if longonmarket then 
     sell at tradeprice + tradeprice*itr/100 limit
     sell at tradeprice – entryprice*si/100 stop
    elsif shortonmarket then 
     exitshort at tradeprice – tradeprice*itr/100 limit
     exitshort at tradeprice + tradeprice*si/100 stop
    endif
    #124785 quote
    MajorBasse
    Participant
    Average

    The only thing not working in your code is “entryprice” PRT says the variable is undefined

    Thanks

    #124792 quote
    Vonasi
    Moderator
    Master

    Replace entryprice with tradeprice. I think it is a typo by Nicolas.

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

Inside bar code conversion


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
MajorBasse @majorbasse Participant
Summary

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

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 04/03/2020
Status: Active
Attachments: No files
Logo Logo
Loading...