Announcement

Collapse
No announcement yet.

Realtime Strategy with Limit Entries

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

  • Realtime Strategy with Limit Entries

    I've attached a simple long-only study I'm testing.

    I've researched all the backtesting tutorials and am having trouble resetting the entry orders for when my limit price doesn't fill. I also cannot seem to figure out why a couple graphic lines don't produce the expected results.

    Any help you may be able to provide will be greatly appreciated.

    Sincerely,
    Kirk
    Attached Files

  • #2
    rev 1

    been working wih the btProfit-target.efs to get some more ideas for this long-only study.

    I figured a couple things out, needed to place exits, eliminate the "notfilled" condition, etc.

    I need to know how to extend the vEntryPrice and vTargetPrice to the right until they are filled.

    please see the attached revised efs

    thanks for any help you can give
    Attached Files
    Last edited by zeller4; 09-25-2007, 08:54 AM.

    Comment


    • #3
      Kirk
      In this thread you can find a basic example of a way to plot target (and stop) values for the duration of the trade.
      Even though that logic makes use of the strategy object to determine the state of the trade you should find it easy to adapt it to your script and to add the entry price.
      If instead of plotting the values you would rather draw them as lines then you just need to add the following drawLineRelative() commands
      PHP Code:
      drawLineRelative(0Target1TargetPS_SOLID,1Color.lime"Target"+getCurrentBarCount());
      drawLineRelative(0Stop1StopPS_SOLID1Color.red"Stop"+getCurrentBarCount()); 
      to this section of code
      PHP Code:
      if(Strategy.isLong()==true){
              
      setPriceBarColor(Color.blue);

      and remove the corresponding elements from the return statement.
      Hope this helps
      Alex

      Comment


      • #4
        Thanks, Alex,

        that works great with your sample, I'll give it a try on my script without the Strategy object.

        I'd never seen it done that way...

        I appreciate your help!

        Kirk

        Comment


        • #5
          Alex, Jason, or anyone who may know,

          I've tried to find more info on "support functions" similar to partial script attached. Unless I'm missing something, it appears some lines will not process in this manner. Are there restrictions on the type of code written below the return line(#225)? Or please direct me to the KB article or other tutorials that may apply...

          thanks in advance,
          kz
          Attached Files
          Last edited by zeller4; 09-26-2007, 11:58 AM.

          Comment


          • #6
            Kirk
            I don't see anything wrong with the code displayed in the image.
            To answer your question any code that comes after the return statement in lines 225-229 and that is contained within that same function will not be executed. If instead it is located outside of that function as a function of its own then it will be executed when called by the main (or other) function.
            Alex

            Comment

            Working...
            X