Take profit based on the entry

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #182176 quote
    Amin1233
    Participant
    Junior

    Hi I am trying to set the target profit based on the difference from my entry and the lowest point of the last bar. Any idea why it is not working?

    if close[0]>open[1] then

    TL=30-(close[0]-lowest[1])

    buy 10 contracts at  market

    set target profit TL

    endif

    #182207 quote
    robertogozzi
    Moderator
    Master

    In line 2 how can you be sure the prior LOW is lower than current CLOSE and that 30 is greater than that difference? I suggest that you use:

    TL=abs(30-abs(close[0]-lowest[1]))

    Furthermore, what is 30? Is it a price difference or pips (in some cases it can be the same, but it’s better to code it correctly).
    If it’s pips then use:

    TL=abs(30*PipSize-abs(close[0]-lowest[1]))

    it will make no difference if used with DOW, DAX, etc…, but will make a huge one with most currency pairs.

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

Take profit based on the entry


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Amin1233 @amin1233 Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by robertogozzi
4 years, 3 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 11/24/2021
Status: Active
Attachments: No files
Logo Logo
Loading...