Problem with Stoploss function

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #33696 quote
    DespairDespair
    Blocked
    Master

    I have a strange problem. The stop loss function does not work for me if i want to use a level from the chart. Example:

    sl=dlow(1)

    set stop loss sl

    It simply does not work.

    If i instead use a stop in points it works without problems. Example:

    sl=100

    set stop ploss sl

    Can anybody help? Where is my mistake?

    #33697 quote
    JC_BywanJC_Bywan
    Moderator
    Master

    Hi,

    Your sl variable in set stop ploss sl should be a distance in points not a level, if you stay it’s equal to dlow(1), you’re not giving it the distance (entryprice-dlow(1)) between your entry and dlow(1), you’re making the distance itself equal to dlow(1), which is likely to be too huge an amount in points to ever be trigered

    #33700 quote
    DespairDespair
    Blocked
    Master

    Actually i do not. The second example with ploss (giving the distance to the stoploss in points) i have no problem. It is the first example where i want to give the stoploss as a level and not a distance that does not work.

    #33702 quote
    DespairDespair
    Blocked
    Master

    Have you seen that in the first example i wrote “set stop loss” and not “set stop ploss”?

    Or i ask different. How do i set a stop loss at a level and not a distance?

    #33703 quote
    NicolasNicolas
    Keymaster
    Legend

    You can’t put a stoploss at a level. ploss is actually in points, while loss is in décimal format. For a 10 pips stoploss for EURUSD, you should do it like this:

    set stop loss 0.0010
    // or 
    set stop ploss 10
    #33704 quote
    JC_BywanJC_Bywan
    Moderator
    Master

    You’re right to notice I didn’t see the first was just loss rather than ploss, true I was only looking at the sl=dlow(1) vs the sl=100…

    However, it doesn’t change the answer, because unless I’m mistaken both loss and ploss require a distance with their syntax, not a level… so set stop loss dlow(1) would still consider dlow(1) as a distance and even if it’s not with ploss it would need “entryprice-dlow(1)” rather than dlow(1)

    Also Nicolas might correct me but I think I remember reading him once saying that ploss might disappear in a future PRT version and only loss would remain (to be confirmed by him, that’s just a vague memory I’m having here), which might explain why the documentation with “ploss” in the url now points to “loss” rather than “ploss”:

    https://www.prorealcode.com/documentation/ploss/

    I am not aware of another keyword with “set stop” that would set up a stop loss directly on a level without calculating the distance.

    The only way to work directly with a level and not a distance would be to use a pending stop order, but need to be aware that these type of orders are valid only during one candle, so the code needs to be written in a such a way it would reset it again at each candle it’s needed

    https://www.prorealcode.com/documentation/stop-pending/

    Despair thanked this post
Viewing 6 posts - 1 through 6 (of 6 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

Problem with Stoploss function


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Despair @despair Blocked
Summary

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

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