Set take profit on Pivot Point level

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #88107 quote
    MarcoDSP
    Participant
    Junior
    hi everyone, 
    I would like to set a take profit condition for a proorder strategy.
    The take profit must be set at the level of the daily pivot point when the position is opened.
    I tried with this code:
     
    // Conditions for exiting long positions
    indicator6 = (DHigh (1) + DLow (1) + DClose (1)) / 3
    c26 = (close <= indicator6)
     
    IF c26 THEN
    SELL AT MARKET
    ENDIF

     

     unfortunately with this code the pivot point is updated according to the new price trend. I would like to set the take profit at the level of the daily pivot point at the time the order is opened.
    It can be done?
    thanx Marco
    #88109 quote
    Vonasi
    Moderator
    Master

    Just save the value at the time that the buy order is placed and then place a pending sell stop order at each bar close. Alternatively just sell at that price or below that price as you did in your code.

    if (your conditions) then
    buy 1 contract at market
    exitprice = (DHigh (1) + DLow (1) + DClose (1)) / 3
    sell at exitprice stop
    endif
     
    IF longonmarket THEN
    sell at exitprice stop
    ENDIF
    if (your conditions) then
    buy 1 contract at market
    exitprice = (DHigh (1) + DLow (1) + DClose (1)) / 3
    endif
     
    IF longonmarket and close <= exitprice THEN
    sell at market
    ENDIF

    Note: Please use the ‘Insert PRT Code’ button when putting code in your future posts as it makes it easier for others to read. I have tidied up your post for you. 🙂

    #88140 quote
    MarcoDSP
    Participant
    Junior

    thanks for the reply Vonasi, and thank you for ordering my post. In the future I will use the right function to enter the codes here.

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

Set take profit on Pivot Point level


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
MarcoDSP @marco_cardone Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by MarcoDSP
7 years, 1 month ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 01/07/2019
Status: Active
Attachments: No files
Logo Logo
Loading...