Announcement

Collapse
No announcement yet.

How to set stop and target?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to set stop and target?

    Upon entering a trade, I want to set a protective stop if the trade goes opposite my direction and also set a stop or limit order to be executed in future bars if a target I specify is hit. I've tried the code below (for a short) but it results in constant trades for each entry that have nothing to do with the future prices.

    if (vLastAlert != 3) Strategy.setStop(high()+stopOffset);
    if (vLastAlert != 3) Strategy.setStop(close()-vTarget);

    I've also considered setting a limit order at the entry price plus my target, but don't see 1) how to keep it in place for future bars until the original trade is completed and 2) how to cancel the limit order if another condition closes the trade.

    Help!

  • #2
    FiveString
    You may want to read the Guide to Developing EFS Strategies available in the Help Guides section of the EFS KnowledgeBase which includes specific examples for setting stops and profit targets.
    Alex

    Comment


    • #3
      Thank you. This looks like it will be very helpful. I had found the Guides for Developing eSignal Indicators and Intro to Back Testing and Strategy Analyzer Guide and went through all of the EFS Java videos, but missed this one.

      I'll work on it.

      Comment

      Working...
      X