Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Need Help for my first strategy

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

    Need Help for my first strategy

    Hello to you


    I can manipulate my script edito by now.


    But I'm nowhere, let's be honnest. There are so many commands that you would save me time indicating me whitch set of command I could Start with for my first «own scrpit ».


    I read a lot in the forum but didn't find what I want or maybe came accross without noticing that was the command Iwas looking for.


    I will give and example I think this is the best way


    I intend working this way


    protectedoverridevoid Initialize()
    {


    CalculateOnBarClose = False;
    }


    I'm not interested in bars closed though I know it is CPU intensive


    I have the EURJPY a 120,55


    I will write this example for a long entry but the logic would be the same if I would go short


    As I enable my strategy, I want this 120,55 value stored in a « double » variable


    (This is my first problem, I have been unable to find a way for doing so)




    Let's say The EURJPY moves up 1 pip up to 120,56


    At time I want to start a stop watch to 0 second




    First case


    The EURJPY moves up 4 more pips to 120,60 within 3 seconds, I would enter long


    Second Case


    3 seconds have elapsed and the EURJPY moved up to 120,59


    It didn't fill my condtions to enter long and the stop watch resets to Zero


    Third Case


    The EURJPY went up to 120,58 and then back down to 120,57. Well, it didn't fill my conditions either


    But....


    It might be a new begining of a short entry process


    I went down one pip, didn't he ?


    I now want the 120,58 stored in my double Variable and restart a stop wath to Zero


    And If the EURJPY moved down within 3 second I enter Short.


    TO REPHASE THIS IN SHORT

    1. How to I do To get the Actual Value of the EURJPY in a variable as I start my strategy.
    2. How do I start a stop watch


    Thanks in advance






    Benwinckelmans

    #2
    Ben, when you're running your script with CalculateOnBarClose = false you have access to the first tick seen live and you can store this in a variable for later reference.



    To see an example of using a custom timer in a script, please review -

    Comment


      #3
      Thanks Bertrand. I will have a look at your suggestion

      Comment


        #4
        Ben, think sbout using the Strategy Wizard for building strategies since it will provide the framework that can add many options. Then have your custom piece written as a paste in. That way you can easily test many varieties of indicators without doing a lot of coding.

        The trick is to be able to hav ethe pluggable code right so it can be plugged in when you are ready.

        I am not a coder so this is what I am trying to do.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        647 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        369 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        108 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        572 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        573 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X