Announcement

Collapse
No announcement yet.

Renegrade Script Issue

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

  • Renegrade Script Issue

    Getting some looping!!

    Been working on this problem all night and can not find the error!! Right now Im using playback to test this script. If you forward to 9:00am (any day will do) and the pnlong() or pnlshort() entry goes off over and over again in a loop.
    If I hit RELOAD on the study it stops looping and behaves correctly. Also if I turn on computeonclose it behaves correctly. I need to have it off though for what im doing. Weird..

    Code is still really messy and unorganized. The script calls an external script, strategy.efs which just returns -1, 0 or 1 (short, flat, long). Frustrated and tired.. night all.

    Anyway its attached to this message if anyone can give me a pointer/tip.
    Attached Files

  • #2
    I was having a similiar problem, not sure if this applies but worth a try.

    When loading a study in realtime if GETBARSTATE == NEWBAR is not specified then for each tick your code will be executed which maybe why you are continually getting output to the debugger.

    You have been one busy beaver my friend.......hope it's paying off.
    Glen Demarco
    [email protected]

    Comment


    • #3
      Hello Geoff,

      In order to test your code and provide any specific solution or guidance you will also need to post your strategy.efs study.

      In looking through some of your code I noticed something that could possibly be related to the problem your are describing. For example, on line 576 you are making a call to pnllong(), which does not exist in the formula you posted. There isn't a pnlong() either in case that was a typo. Anyway, that would be the first thing to look into.

      Aside from that, the way to identify where the problematic code resides is to first comment out all your current debugPrintln() statements. Then, starting somewhere near the top of main add one debug statement followed by a return statement. Test the code. Did the error occur? If not, move the debug and return statement a little further down in the order of process and test again. Repeat this process until the looping problem occurs. Once you uncover where the problem is, it may become more obvious. If not, post a follow up to this thread with more details of your findings.
      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


      • #4
        Uh oh!..Good eyes (and brain) hehe..

        Dangit I knew using a variable with two letters next to each other would nag me. I never got an error in the compiler window though. I've fixed that but am still having the issue. Its a fresh day. I'll take another look at it now.

        Comment


        • #5
          Do Strategy.?? commands work on tick by tick bases? Since they were designed to be used for the back tester maybe there is a problem using them with tick data. Im using those in real time because I was too lazy to figure out a method of keeping track of current size, if i was in a trade or not etc.. So you see on these lines:

          Strategy.doLong("Long Entry", Strategy.MARKET, Strategy.NEXTBAR, size );
          if ( gTest != 1 ) buyMarket(getSymbol(), size ); // Send long entry to broker
          EntryPrice = (high() + low())/2; // set entry price to close of this candle
          EntryTime = rawtime(0);
          debugPrintln("We are long at "+close() );

          I'm telling it to go long then I have another area check for 'Strategy.isLong' which would always print false since on a tick basis hasn't filled at the next bar yet. Then its going to keep hitting the loop because there is no active trade. Then it wil just reissue this command telling it to hit the next bar again and continue on and on. This may be whats happening.

          Now how to fix it? I'm thinking maybe change strategy to limit thisbar and specify close() as the price?? Hmm

          Comment


          • #6
            Just to follow up I took the nexbar stuff out and changed it to THISBAR and its all working perfectly now. Unless I screw it up later this evening. You can't use nextbar in real time tick by tick!! hehe What was I thinking.

            Comment

            Working...
            X