Announcement

Collapse
No announcement yet.

Entry Price THISBAR - Want PREVIOUS BAR

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

  • Entry Price THISBAR - Want PREVIOUS BAR

    I hope someone can help, my basic theroy is i look for 3 up bars, no problem. Then I want to enter if the low of the previous bar is broken. I only seem to be able to select my entry price as THISBAR or NEXTBAR, what I want is to use the low of the previous bar as entry. Is this possible, I am sure it must be because most people will be looking for the break of a previous bars high/low for their entry strategies.

    Thanks in advance.

  • #2
    Hello wilczek,

    Your entry condition evaluates the signal for the entry. The Strategy methods simply report your desired trade to the Strategy Analyzer. Your entry condition in this case needs to look at the low on the previous bar by specifying the -1 bar index and comparing it to the current bar's low.

    PHP Code:

    if (low(0) < low(-1)  && Strategy.isShort() == false) {
         
    // previous bar's low was broken
        
    Strategy.doShort("Low broken"Strategy.LIMITStrategy.THISBARStrategy.DEFAULT, Math.min(open(0), low(-1)) );

    The entry price recorded would need to be the lower value between the open of the current bar and the low of the previous bar as the open could be the price that would first trigger the entry if the current bar opened below the previous bar's low.

    You can find more detailed explanations and code examples of how to code back testing formulas in our Beginner Tutorials.
    Jason K.
    Project Manager
    eSignal - an Interactive Data company

    EFS KnowledgeBase
    JavaScript for EFS Video Series
    EFS Beginner Tutorial Series
    EFS Glossary
    Custom EFS Development Policy

    New User Orientation

    Comment

    Working...
    X