Inside bar code conversion

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #124448 quote
    MajorBasseMajorBasse
    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
    NicolasNicolas
    Keymaster
    Legend

    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
    MajorBasseMajorBasse
    Participant
    Average

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

    Thanks

    #124792 quote
    VonasiVonasi
    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.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

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 VonasiVonasi
6 years, 6 months ago.

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