Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

zigzag

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

    zigzag

    Hi, I am using zigzag inside an automated strategy to identify ABC patterns where in a long trade A[High] B[Low] C[Higher high] - once in a trade I want to use C as my stop. Unfortunately I dont know how to tell Ninja that once we are in a trade I want it to use the C prior to the trade as my stop and not any 'new' C that it may identify after trade entry. How do I 'anchor' the C prior to the trade as the C to use? TIA

    #2
    mullum,
    I am not sure if I understand exactly your problem. If you mean that after the C (the higher high) is formed you go short and you want C to be your stop loss then to find the barsago you use:
    c_barsago=ZigZag(DeviationType.Points, 0.5, false).HighBar(0, 1, 100))]);
    and to find the value:
    c_value=ZigZag(................................... ).ZigZagHigh[c_barsago];

    In order to "lock" your stop C to the above value you need to use a switch.
    Something like this:

    if(initializing your strategy)
    {
    ......;
    ......;
    switch=1;
    }
    else
    switch=2;

    if(switch=1 && ......)
    {
    c_barsago=....;
    c_value=...;
    switch=2;
    }

    if(switch=2 && ....)
    {
    profitTarget= ...
    stopLoss = c_value;

    }

    Cheers

    Comment


      #3
      zigzag

      Thanks Astra

      What I am doing is [in long trade] we identify A[first low] B[High] C[lower low] and we then set buy stop @ B with a stoploss at C.

      So regarding your suggestion I only need to find the C value not bars ago - correct? And the I use a switch to lock the C value correct? Thanks very much for your help

      Comment


        #4
        Originally posted by mullum View Post

        So regarding your suggestion I only need to find the C value not bars ago - correct?
        No, you need both. You cannot find the C value if you don't have the bars ago. Because in the bars ago you define the instance, in your case 1.

        With the ZigZag indicator is very important the timing: In real time, the time the C is formed is after at least a minimum of 2 bars in the opposite direction. You can capture this moment in your code by using: if(peak_barsago>trough_barsago)
        {
        and load here all your targets and stop losses PLUS the switch in this statement.
        }

        Comment


          #5
          zigzag

          Thanks Astra - my programming skills are not up to scratch - I have tried but am unable to complete your instructions. I paid someone to write the initial code for me but he wasn't up to the task and now I have 99% completed code and am not sure where to go from here - thx anyway

          Comment


            #6
            Zigzag

            Hi Astra

            Can you point me in the direction to find info on how to write the correct code for a switch - I cant find it in the NT help files - thanks

            Comment


              #7
              zigzag

              [QUOTE...in a long trade A[High] B[Low] C[Higher high] - once in a trade I want to use C as my stop.

              I got this wrong in my earlier post

              It should read "in a long trade A[Low] B[High] C[lower/lowest Low] and use B as buy entry on a retrace higher

              Comment


                #8
                Zigzag

                Astra

                Would you have any interest in helping me sort out the code I am looking for? I am happy to pay a fee for your services

                thx

                Comment


                  #9
                  Hi mullum,

                  Originally posted by mullum View Post
                  Hi Astra

                  Can you point me in the direction to find info on how to write the correct code for a switch - I cant find it in the NT help files - thanks
                  I meant "switch", the programming technique that is widely used to have control of building blocks visits - in this case "if" statements, because it reseambles the behavior of an ordinary real world (light?) switch. Can be any word you define as such. For example, in the variables section you can define a "switch-technique" as, say, private int tralala=0;

                  Sorry for the confusion, but I assumed you were aware of it because the zigzag indicator is considered an advance indicator in terms of programming skills and almost always you need a switch-technique to make it work.

                  Now, I am a trader not a programmer (only over a year experience with C#) . But as at the moment I am developing an indicator that makes use of the zigzag I can be of help if I can. If you wish post the relevant part of your code here (without the details) and see.

                  Comment


                    #10
                    Check also the other zigzag indicator available here:


                    You can also see how a "switch-technique" is used in this code (defined as "dir").

                    Cheers

                    Comment


                      #11
                      zizzag

                      can zigzag be used in market analyzer? for signals?

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by RideMe, 04-07-2024, 04:54 PM
                      5 responses
                      28 views
                      0 likes
                      Last Post NinjaTrader_BrandonH  
                      Started by f.saeidi, Today, 08:13 AM
                      1 response
                      5 views
                      0 likes
                      Last Post NinjaTrader_ChelseaB  
                      Started by DavidHP, Today, 07:56 AM
                      1 response
                      6 views
                      0 likes
                      Last Post NinjaTrader_Erick  
                      Started by kujista, Today, 06:23 AM
                      3 responses
                      10 views
                      0 likes
                      Last Post kujista
                      by kujista
                       
                      Started by Mindset, Yesterday, 02:04 AM
                      2 responses
                      18 views
                      0 likes
                      Last Post NinjaTrader_RyanS  
                      Working...
                      X