DailyFX Home | Español | Français | 中文 | Deutsch | Italiano | العربية | Sverige | Ελληνικά


+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    charliev is offline Member charliev is an unknown quantity at this time
    Join Date
    Jul 2010
    Posts
    59

    Stoploss and Take profit.

    (Trading Gurus, please stay out of this thread)

    Hello,

    I am entering a Range Order using:

    Code:
    buy_order.Generate(Bars.CloseValue + (5*pipSize), Bars.CloseValue - (5*pipSize));Setting a range +/- 5 pips from the close... this works under Build 282.

    Could someone provide a code example for setting the Stop and TakeProfit?

    Replies I have see thus far do not set the VALUE of the Stop and Limit... I am NOT talking about a BuyStop or BuyLimit order... I simply want to be able to set the STOPLOSS and TAKE PROFIT values of the Order that is filled.


    Thanks for the help.
    -charliev

  2. #2
    jdavis is offline FXCM Automated Platform Specialist jdavis is an unknown quantity at this time
    Join Date
    Jan 2010
    Posts
    818
    To be placed after your code for creating the position....


    GenerateProfitTarget(YOUR TAKE PROFIT PRICE);
    GenerateStopLoss(YOUR STOP LOSS PRICE);

    -jd
    API Team

  3. #3
    charliev is offline Member charliev is an unknown quantity at this time
    Join Date
    Jul 2010
    Posts
    59
    Quote Originally Posted by jdavis View Post
    To be placed after your code for creating the position....


    GenerateProfitTarget(YOUR TAKE PROFIT PRICE);
    GenerateStopLoss(YOUR STOP LOSS PRICE);

    -jd
    Thank you jd.

    How do I get the Order Filled price? I would like to calculate the stops from the filled price. Is there an object that holds the most recent order information?

    -charliev

  4. #4
    Gaurav is offline Gold Member Gaurav is an unknown quantity at this time
    Join Date
    Mar 2010
    Posts
    496
    Quote Originally Posted by charliev View Post
    Thank you jd.

    How do I get the Order Filled price? I would like to calculate the stops from the filled price. Is there an object that holds the most recent order information?

    -charliev
    You can use this to get order open price.
    CurrentPosition.OpenTrades[0].Entry.Price;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Disclaimer: Trading foreign exchange on margin carries a high level of risk, and may not be suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to trade foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with foreign exchange trading, and seek advice from an independent financial advisor if you have any doubts. Any opinions, news, research, analyses, prices, or other information contained on this website is provided as general market commentary and does not constitute investment advice. Forex Capital Markets LLC. will not accept liability for any loss or damage, including without limitation to, any loss of profit, which may arise directly or indirectly from use of or reliance on such information.