script help, coding a Weis Wave











up vote
1
down vote

favorite












I'm calculating VWAP in sections, every time the close has a difference with the running VWAP greater than the deviation, it flips the trend and starts a new VWAP count. Volume should be aggregated within each trend.



So far volume aggregates on the uptrend but not on the downtrend. Also, when switching from down to up, the uptrend volume "steals" the last downtrend volume and adds it to its own. This is all very confusing since the logic is quite simple...



Here is my code:



//@version=3
study("My Script")
deviation = input(title = "Deviation %", type=float, defval = 0.1)
running_vol = 0.0
running_sum = 0.0
Tup = true
Tdown = false

running_vol := nz(volume[1]) == 0 ? 0 : running_vol[1] + volume
running_sum := nz(volume[1]) == 0 ? 0 : running_sum[1] + (close*volume)

volwap = (running_sum/running_vol)

// flip to downtrend
if (Tup == true) and (Tdown == false) and (close < close[1]) and ((1 - (close/volwap)) > (deviation/100.0))
// reset running_vol and sum to current volume and sum since it's a new trend
running_vol := volume
running_sum := (close*volume)
// flip the trend switches
Tup := false
Tdown := true
// flip to uptrend
if (Tup == false) and (Tdown == true) and (close > close[1]) and (((close/volwap) - 1) > (deviation/100.0))
running_vol := volume
running_sum := (close*volume)
Tup := true
Tdown := false


up = Tup == true ? running_vol : 0
down = Tdown == true ? running_vol : 0

plot(up, style=histogram, color=green, linewidth=3)
plot(down, style=histogram, color=red, linewidth=3)









share|improve this question




























    up vote
    1
    down vote

    favorite












    I'm calculating VWAP in sections, every time the close has a difference with the running VWAP greater than the deviation, it flips the trend and starts a new VWAP count. Volume should be aggregated within each trend.



    So far volume aggregates on the uptrend but not on the downtrend. Also, when switching from down to up, the uptrend volume "steals" the last downtrend volume and adds it to its own. This is all very confusing since the logic is quite simple...



    Here is my code:



    //@version=3
    study("My Script")
    deviation = input(title = "Deviation %", type=float, defval = 0.1)
    running_vol = 0.0
    running_sum = 0.0
    Tup = true
    Tdown = false

    running_vol := nz(volume[1]) == 0 ? 0 : running_vol[1] + volume
    running_sum := nz(volume[1]) == 0 ? 0 : running_sum[1] + (close*volume)

    volwap = (running_sum/running_vol)

    // flip to downtrend
    if (Tup == true) and (Tdown == false) and (close < close[1]) and ((1 - (close/volwap)) > (deviation/100.0))
    // reset running_vol and sum to current volume and sum since it's a new trend
    running_vol := volume
    running_sum := (close*volume)
    // flip the trend switches
    Tup := false
    Tdown := true
    // flip to uptrend
    if (Tup == false) and (Tdown == true) and (close > close[1]) and (((close/volwap) - 1) > (deviation/100.0))
    running_vol := volume
    running_sum := (close*volume)
    Tup := true
    Tdown := false


    up = Tup == true ? running_vol : 0
    down = Tdown == true ? running_vol : 0

    plot(up, style=histogram, color=green, linewidth=3)
    plot(down, style=histogram, color=red, linewidth=3)









    share|improve this question


























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I'm calculating VWAP in sections, every time the close has a difference with the running VWAP greater than the deviation, it flips the trend and starts a new VWAP count. Volume should be aggregated within each trend.



      So far volume aggregates on the uptrend but not on the downtrend. Also, when switching from down to up, the uptrend volume "steals" the last downtrend volume and adds it to its own. This is all very confusing since the logic is quite simple...



      Here is my code:



      //@version=3
      study("My Script")
      deviation = input(title = "Deviation %", type=float, defval = 0.1)
      running_vol = 0.0
      running_sum = 0.0
      Tup = true
      Tdown = false

      running_vol := nz(volume[1]) == 0 ? 0 : running_vol[1] + volume
      running_sum := nz(volume[1]) == 0 ? 0 : running_sum[1] + (close*volume)

      volwap = (running_sum/running_vol)

      // flip to downtrend
      if (Tup == true) and (Tdown == false) and (close < close[1]) and ((1 - (close/volwap)) > (deviation/100.0))
      // reset running_vol and sum to current volume and sum since it's a new trend
      running_vol := volume
      running_sum := (close*volume)
      // flip the trend switches
      Tup := false
      Tdown := true
      // flip to uptrend
      if (Tup == false) and (Tdown == true) and (close > close[1]) and (((close/volwap) - 1) > (deviation/100.0))
      running_vol := volume
      running_sum := (close*volume)
      Tup := true
      Tdown := false


      up = Tup == true ? running_vol : 0
      down = Tdown == true ? running_vol : 0

      plot(up, style=histogram, color=green, linewidth=3)
      plot(down, style=histogram, color=red, linewidth=3)









      share|improve this question















      I'm calculating VWAP in sections, every time the close has a difference with the running VWAP greater than the deviation, it flips the trend and starts a new VWAP count. Volume should be aggregated within each trend.



      So far volume aggregates on the uptrend but not on the downtrend. Also, when switching from down to up, the uptrend volume "steals" the last downtrend volume and adds it to its own. This is all very confusing since the logic is quite simple...



      Here is my code:



      //@version=3
      study("My Script")
      deviation = input(title = "Deviation %", type=float, defval = 0.1)
      running_vol = 0.0
      running_sum = 0.0
      Tup = true
      Tdown = false

      running_vol := nz(volume[1]) == 0 ? 0 : running_vol[1] + volume
      running_sum := nz(volume[1]) == 0 ? 0 : running_sum[1] + (close*volume)

      volwap = (running_sum/running_vol)

      // flip to downtrend
      if (Tup == true) and (Tdown == false) and (close < close[1]) and ((1 - (close/volwap)) > (deviation/100.0))
      // reset running_vol and sum to current volume and sum since it's a new trend
      running_vol := volume
      running_sum := (close*volume)
      // flip the trend switches
      Tup := false
      Tdown := true
      // flip to uptrend
      if (Tup == false) and (Tdown == true) and (close > close[1]) and (((close/volwap) - 1) > (deviation/100.0))
      running_vol := volume
      running_sum := (close*volume)
      Tup := true
      Tdown := false


      up = Tup == true ? running_vol : 0
      down = Tdown == true ? running_vol : 0

      plot(up, style=histogram, color=green, linewidth=3)
      plot(down, style=histogram, color=red, linewidth=3)






      trading-view pine-script






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 25 at 22:31









      not2qubit

      3,93813260




      3,93813260










      asked Nov 15 at 1:50









      momo

      5411517




      5411517
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote



          accepted










          In the original script the self-referencing of Tup and Tdown are problematic. You must refer to past Tup and Tdown otherwise the user-defined Tup=true and tdown =false are reintroduced on each sweep through the script. Since Tup is re-initiated as true on each sweep you can only have one bear volume bar at a time. I also see issues with the desired turning point strategy for this novel and interesting wave definition. Some playing may well find a turning point that satisfies you better than what plots from this script. I have used tried to remain true to your use of volwap and close[1] relative to close[0] but I am not sure I have captured it in the way you truly intended. I hope this gives you a starting point to refine your wave definition. Here is my pine script rendition of your code. Cheers Jayy:



          //@version=3
          // my impression of the Weis VWAP code by Moreina by Jayy
          study("Moreina Weis vwap")
          deviation = input(title = "Deviation %", type=float, defval = 0.00000000)
          running_vol = 0.0
          running_sum = 0.0
          Tup = 0

          count=1
          count:= nz(count[1])+1
          running_vol := Tup[1]!=Tup[2] and nz(running_vol[1])==nz(volume[1])? nz(running_vol[1]) + volume: (Tup[1]==1 and Tup[2]==1) or (Tup[1]==-1 and Tup[2]==-1)? nz(running_vol[1]) + volume:na
          running_sum := Tup[1]!=Tup[2] and nz(running_sum[1])==nz(close[1]*volume[1])? nz(running_sum[1]) + close*volume: (Tup[1]==1 and Tup[2]==1) or (Tup[1]==-1 and Tup[2]==-1)? nz(running_sum[1]) +close* volume:na

          volwap = (running_sum/running_vol)

          // flip to downtrend
          if ((Tup[1] == 1) or (Tup[1] == 0)) and not ((close > close[1]) or (close/volwap)>1) //

          // reset running_vol and sum to current volume and sum since it's a new trend
          running_vol := volume
          running_sum := (close*volume)
          // flip the trend switches
          Tup := -1

          // flip to uptrend
          if ((Tup[1] == -1) or (Tup[1] == 0)) and not ((close < close[1]) or ((close/volwap)) <1) //and (close/volwap) > 1)

          running_vol := volume
          running_sum := (close*volume)
          Tup := 1


          Tup:= nz(Tup[0])==1 and count>1?Tup[0]:nz(Tup[0])==-1 and count>1?Tup[0]: count>1 and Tup[0]==0?nz(Tup[1]):na//Tup
          up = Tup == 1 ? running_vol : na
          down = Tup == -1 ? running_vol : na

          plot(up, style=histogram, color=green, linewidth=3)
          plot(down, style=histogram, color=red, linewidth=3)





          share|improve this answer





















          • changed the trend flip code to: // flip to downtrend if ((Tup[1] == 1) or (Tup[1] == 0)) and (((close < close[1]) and (close < close [2])) or not ((close > close[1]) or ((close+(volwap*(deviation/100)))/volwap)>1)) // and // flip to uptrend if ((Tup[1] == -1) or (Tup[1] == 0)) and (((close > close[1]) and (close > close[2])) or not ((close < close[1]) or (((close+(volwap*(deviation/100)))/volwap)) <1)) //and (close/volwap) > 1) borrowing the two fold close from Lazy Bear.
            – momo
            Nov 30 at 14:28













          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53311317%2fscript-help-coding-a-weis-wave%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          1
          down vote



          accepted










          In the original script the self-referencing of Tup and Tdown are problematic. You must refer to past Tup and Tdown otherwise the user-defined Tup=true and tdown =false are reintroduced on each sweep through the script. Since Tup is re-initiated as true on each sweep you can only have one bear volume bar at a time. I also see issues with the desired turning point strategy for this novel and interesting wave definition. Some playing may well find a turning point that satisfies you better than what plots from this script. I have used tried to remain true to your use of volwap and close[1] relative to close[0] but I am not sure I have captured it in the way you truly intended. I hope this gives you a starting point to refine your wave definition. Here is my pine script rendition of your code. Cheers Jayy:



          //@version=3
          // my impression of the Weis VWAP code by Moreina by Jayy
          study("Moreina Weis vwap")
          deviation = input(title = "Deviation %", type=float, defval = 0.00000000)
          running_vol = 0.0
          running_sum = 0.0
          Tup = 0

          count=1
          count:= nz(count[1])+1
          running_vol := Tup[1]!=Tup[2] and nz(running_vol[1])==nz(volume[1])? nz(running_vol[1]) + volume: (Tup[1]==1 and Tup[2]==1) or (Tup[1]==-1 and Tup[2]==-1)? nz(running_vol[1]) + volume:na
          running_sum := Tup[1]!=Tup[2] and nz(running_sum[1])==nz(close[1]*volume[1])? nz(running_sum[1]) + close*volume: (Tup[1]==1 and Tup[2]==1) or (Tup[1]==-1 and Tup[2]==-1)? nz(running_sum[1]) +close* volume:na

          volwap = (running_sum/running_vol)

          // flip to downtrend
          if ((Tup[1] == 1) or (Tup[1] == 0)) and not ((close > close[1]) or (close/volwap)>1) //

          // reset running_vol and sum to current volume and sum since it's a new trend
          running_vol := volume
          running_sum := (close*volume)
          // flip the trend switches
          Tup := -1

          // flip to uptrend
          if ((Tup[1] == -1) or (Tup[1] == 0)) and not ((close < close[1]) or ((close/volwap)) <1) //and (close/volwap) > 1)

          running_vol := volume
          running_sum := (close*volume)
          Tup := 1


          Tup:= nz(Tup[0])==1 and count>1?Tup[0]:nz(Tup[0])==-1 and count>1?Tup[0]: count>1 and Tup[0]==0?nz(Tup[1]):na//Tup
          up = Tup == 1 ? running_vol : na
          down = Tup == -1 ? running_vol : na

          plot(up, style=histogram, color=green, linewidth=3)
          plot(down, style=histogram, color=red, linewidth=3)





          share|improve this answer





















          • changed the trend flip code to: // flip to downtrend if ((Tup[1] == 1) or (Tup[1] == 0)) and (((close < close[1]) and (close < close [2])) or not ((close > close[1]) or ((close+(volwap*(deviation/100)))/volwap)>1)) // and // flip to uptrend if ((Tup[1] == -1) or (Tup[1] == 0)) and (((close > close[1]) and (close > close[2])) or not ((close < close[1]) or (((close+(volwap*(deviation/100)))/volwap)) <1)) //and (close/volwap) > 1) borrowing the two fold close from Lazy Bear.
            – momo
            Nov 30 at 14:28

















          up vote
          1
          down vote



          accepted










          In the original script the self-referencing of Tup and Tdown are problematic. You must refer to past Tup and Tdown otherwise the user-defined Tup=true and tdown =false are reintroduced on each sweep through the script. Since Tup is re-initiated as true on each sweep you can only have one bear volume bar at a time. I also see issues with the desired turning point strategy for this novel and interesting wave definition. Some playing may well find a turning point that satisfies you better than what plots from this script. I have used tried to remain true to your use of volwap and close[1] relative to close[0] but I am not sure I have captured it in the way you truly intended. I hope this gives you a starting point to refine your wave definition. Here is my pine script rendition of your code. Cheers Jayy:



          //@version=3
          // my impression of the Weis VWAP code by Moreina by Jayy
          study("Moreina Weis vwap")
          deviation = input(title = "Deviation %", type=float, defval = 0.00000000)
          running_vol = 0.0
          running_sum = 0.0
          Tup = 0

          count=1
          count:= nz(count[1])+1
          running_vol := Tup[1]!=Tup[2] and nz(running_vol[1])==nz(volume[1])? nz(running_vol[1]) + volume: (Tup[1]==1 and Tup[2]==1) or (Tup[1]==-1 and Tup[2]==-1)? nz(running_vol[1]) + volume:na
          running_sum := Tup[1]!=Tup[2] and nz(running_sum[1])==nz(close[1]*volume[1])? nz(running_sum[1]) + close*volume: (Tup[1]==1 and Tup[2]==1) or (Tup[1]==-1 and Tup[2]==-1)? nz(running_sum[1]) +close* volume:na

          volwap = (running_sum/running_vol)

          // flip to downtrend
          if ((Tup[1] == 1) or (Tup[1] == 0)) and not ((close > close[1]) or (close/volwap)>1) //

          // reset running_vol and sum to current volume and sum since it's a new trend
          running_vol := volume
          running_sum := (close*volume)
          // flip the trend switches
          Tup := -1

          // flip to uptrend
          if ((Tup[1] == -1) or (Tup[1] == 0)) and not ((close < close[1]) or ((close/volwap)) <1) //and (close/volwap) > 1)

          running_vol := volume
          running_sum := (close*volume)
          Tup := 1


          Tup:= nz(Tup[0])==1 and count>1?Tup[0]:nz(Tup[0])==-1 and count>1?Tup[0]: count>1 and Tup[0]==0?nz(Tup[1]):na//Tup
          up = Tup == 1 ? running_vol : na
          down = Tup == -1 ? running_vol : na

          plot(up, style=histogram, color=green, linewidth=3)
          plot(down, style=histogram, color=red, linewidth=3)





          share|improve this answer





















          • changed the trend flip code to: // flip to downtrend if ((Tup[1] == 1) or (Tup[1] == 0)) and (((close < close[1]) and (close < close [2])) or not ((close > close[1]) or ((close+(volwap*(deviation/100)))/volwap)>1)) // and // flip to uptrend if ((Tup[1] == -1) or (Tup[1] == 0)) and (((close > close[1]) and (close > close[2])) or not ((close < close[1]) or (((close+(volwap*(deviation/100)))/volwap)) <1)) //and (close/volwap) > 1) borrowing the two fold close from Lazy Bear.
            – momo
            Nov 30 at 14:28















          up vote
          1
          down vote



          accepted







          up vote
          1
          down vote



          accepted






          In the original script the self-referencing of Tup and Tdown are problematic. You must refer to past Tup and Tdown otherwise the user-defined Tup=true and tdown =false are reintroduced on each sweep through the script. Since Tup is re-initiated as true on each sweep you can only have one bear volume bar at a time. I also see issues with the desired turning point strategy for this novel and interesting wave definition. Some playing may well find a turning point that satisfies you better than what plots from this script. I have used tried to remain true to your use of volwap and close[1] relative to close[0] but I am not sure I have captured it in the way you truly intended. I hope this gives you a starting point to refine your wave definition. Here is my pine script rendition of your code. Cheers Jayy:



          //@version=3
          // my impression of the Weis VWAP code by Moreina by Jayy
          study("Moreina Weis vwap")
          deviation = input(title = "Deviation %", type=float, defval = 0.00000000)
          running_vol = 0.0
          running_sum = 0.0
          Tup = 0

          count=1
          count:= nz(count[1])+1
          running_vol := Tup[1]!=Tup[2] and nz(running_vol[1])==nz(volume[1])? nz(running_vol[1]) + volume: (Tup[1]==1 and Tup[2]==1) or (Tup[1]==-1 and Tup[2]==-1)? nz(running_vol[1]) + volume:na
          running_sum := Tup[1]!=Tup[2] and nz(running_sum[1])==nz(close[1]*volume[1])? nz(running_sum[1]) + close*volume: (Tup[1]==1 and Tup[2]==1) or (Tup[1]==-1 and Tup[2]==-1)? nz(running_sum[1]) +close* volume:na

          volwap = (running_sum/running_vol)

          // flip to downtrend
          if ((Tup[1] == 1) or (Tup[1] == 0)) and not ((close > close[1]) or (close/volwap)>1) //

          // reset running_vol and sum to current volume and sum since it's a new trend
          running_vol := volume
          running_sum := (close*volume)
          // flip the trend switches
          Tup := -1

          // flip to uptrend
          if ((Tup[1] == -1) or (Tup[1] == 0)) and not ((close < close[1]) or ((close/volwap)) <1) //and (close/volwap) > 1)

          running_vol := volume
          running_sum := (close*volume)
          Tup := 1


          Tup:= nz(Tup[0])==1 and count>1?Tup[0]:nz(Tup[0])==-1 and count>1?Tup[0]: count>1 and Tup[0]==0?nz(Tup[1]):na//Tup
          up = Tup == 1 ? running_vol : na
          down = Tup == -1 ? running_vol : na

          plot(up, style=histogram, color=green, linewidth=3)
          plot(down, style=histogram, color=red, linewidth=3)





          share|improve this answer












          In the original script the self-referencing of Tup and Tdown are problematic. You must refer to past Tup and Tdown otherwise the user-defined Tup=true and tdown =false are reintroduced on each sweep through the script. Since Tup is re-initiated as true on each sweep you can only have one bear volume bar at a time. I also see issues with the desired turning point strategy for this novel and interesting wave definition. Some playing may well find a turning point that satisfies you better than what plots from this script. I have used tried to remain true to your use of volwap and close[1] relative to close[0] but I am not sure I have captured it in the way you truly intended. I hope this gives you a starting point to refine your wave definition. Here is my pine script rendition of your code. Cheers Jayy:



          //@version=3
          // my impression of the Weis VWAP code by Moreina by Jayy
          study("Moreina Weis vwap")
          deviation = input(title = "Deviation %", type=float, defval = 0.00000000)
          running_vol = 0.0
          running_sum = 0.0
          Tup = 0

          count=1
          count:= nz(count[1])+1
          running_vol := Tup[1]!=Tup[2] and nz(running_vol[1])==nz(volume[1])? nz(running_vol[1]) + volume: (Tup[1]==1 and Tup[2]==1) or (Tup[1]==-1 and Tup[2]==-1)? nz(running_vol[1]) + volume:na
          running_sum := Tup[1]!=Tup[2] and nz(running_sum[1])==nz(close[1]*volume[1])? nz(running_sum[1]) + close*volume: (Tup[1]==1 and Tup[2]==1) or (Tup[1]==-1 and Tup[2]==-1)? nz(running_sum[1]) +close* volume:na

          volwap = (running_sum/running_vol)

          // flip to downtrend
          if ((Tup[1] == 1) or (Tup[1] == 0)) and not ((close > close[1]) or (close/volwap)>1) //

          // reset running_vol and sum to current volume and sum since it's a new trend
          running_vol := volume
          running_sum := (close*volume)
          // flip the trend switches
          Tup := -1

          // flip to uptrend
          if ((Tup[1] == -1) or (Tup[1] == 0)) and not ((close < close[1]) or ((close/volwap)) <1) //and (close/volwap) > 1)

          running_vol := volume
          running_sum := (close*volume)
          Tup := 1


          Tup:= nz(Tup[0])==1 and count>1?Tup[0]:nz(Tup[0])==-1 and count>1?Tup[0]: count>1 and Tup[0]==0?nz(Tup[1]):na//Tup
          up = Tup == 1 ? running_vol : na
          down = Tup == -1 ? running_vol : na

          plot(up, style=histogram, color=green, linewidth=3)
          plot(down, style=histogram, color=red, linewidth=3)






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 28 at 23:06









          Jayy

          261




          261












          • changed the trend flip code to: // flip to downtrend if ((Tup[1] == 1) or (Tup[1] == 0)) and (((close < close[1]) and (close < close [2])) or not ((close > close[1]) or ((close+(volwap*(deviation/100)))/volwap)>1)) // and // flip to uptrend if ((Tup[1] == -1) or (Tup[1] == 0)) and (((close > close[1]) and (close > close[2])) or not ((close < close[1]) or (((close+(volwap*(deviation/100)))/volwap)) <1)) //and (close/volwap) > 1) borrowing the two fold close from Lazy Bear.
            – momo
            Nov 30 at 14:28




















          • changed the trend flip code to: // flip to downtrend if ((Tup[1] == 1) or (Tup[1] == 0)) and (((close < close[1]) and (close < close [2])) or not ((close > close[1]) or ((close+(volwap*(deviation/100)))/volwap)>1)) // and // flip to uptrend if ((Tup[1] == -1) or (Tup[1] == 0)) and (((close > close[1]) and (close > close[2])) or not ((close < close[1]) or (((close+(volwap*(deviation/100)))/volwap)) <1)) //and (close/volwap) > 1) borrowing the two fold close from Lazy Bear.
            – momo
            Nov 30 at 14:28


















          changed the trend flip code to: // flip to downtrend if ((Tup[1] == 1) or (Tup[1] == 0)) and (((close < close[1]) and (close < close [2])) or not ((close > close[1]) or ((close+(volwap*(deviation/100)))/volwap)>1)) // and // flip to uptrend if ((Tup[1] == -1) or (Tup[1] == 0)) and (((close > close[1]) and (close > close[2])) or not ((close < close[1]) or (((close+(volwap*(deviation/100)))/volwap)) <1)) //and (close/volwap) > 1) borrowing the two fold close from Lazy Bear.
          – momo
          Nov 30 at 14:28






          changed the trend flip code to: // flip to downtrend if ((Tup[1] == 1) or (Tup[1] == 0)) and (((close < close[1]) and (close < close [2])) or not ((close > close[1]) or ((close+(volwap*(deviation/100)))/volwap)>1)) // and // flip to uptrend if ((Tup[1] == -1) or (Tup[1] == 0)) and (((close > close[1]) and (close > close[2])) or not ((close < close[1]) or (((close+(volwap*(deviation/100)))/volwap)) <1)) //and (close/volwap) > 1) borrowing the two fold close from Lazy Bear.
          – momo
          Nov 30 at 14:28




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53311317%2fscript-help-coding-a-weis-wave%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          How to change which sound is reproduced for terminal bell?

          Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

          Can I use Tabulator js library in my java Spring + Thymeleaf project?