[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[EquisMetaStock Group] Re: Problem with BarsSince and Sum



PureBytes Links

Trading Reference Links

Thank you Preston,

Regards,

mc

--- In equismetastock@xxxxxxxxxxxxxxx, pumrysh <no_reply@xxx> wrote:
>
> Fernando,
> 
> It appears to me that the solution that MC has written will provide 
> the information that your looking for. If not you will have to let us 
> know.
> 
> MC,
> 
> Once again, very nice! I appreciate your help.
> 
> Preston
> 
> 
> 
> --- In equismetastock@xxxxxxxxxxxxxxx, "p_panther_73" <mchantzi@> 
> wrote:
> >
> > Well, then it seems to me that you're not interested in up-days in 
> a 
> > row but rather to what Preston says.
> > Now, you may try this:
> > 
> > a:=DayOfMonth()<Ref(DayOfMonth(),-1);
> > upV:=Cum(V*(C>Ref(C,-1)));
> > downV:=Cum(V*(C<Ref(C,-1)));
> > upVolumeThisMonth:=upV-ValueWhen(1,a,Ref(upV,-1));
> > downVolumeThisMonth:=downV-ValueWhen(1,a,Ref(downV,-1));
> > upVolumeThisMonth;
> > -downVolumeThisMonth;
> > 
> > Regards,
> > 
> > mc
> > 
> > --- In equismetastock@xxxxxxxxxxxxxxx, "Fernando Santos" 
> > <ptc_man3@> wrote:
> > >
> > > Hi.
> > > 
> > > First of all, let me thanks to Preston and mc for their help.
> > > 
> > > Using the formula that Preston gave:
> > > 
> > > tp:= 14; { time periods in RSI calculation}
> > > plot:= C;
> > > change:= ROC(plot,1,$ );
> > > Z:=Sum(If(change> 0,VOLUME, 0),tp);
> > > Y:=Sum(If(change< 0,Abs(VOLUME) ,0),tp);
> > > Ytemp:=If(y= 0,0.00001, y);
> > > RS:=Z/Ytemp;
> > > 100-(100/(1+ RS))
> > > 
> > > The problem here is the time periods.
> > > As I said, I want to measure volume for each month.
> > > So using Jose's formulas:
> > > 
> > > { User input }
> > > EOM:=Input("Final month's end:  [1]True,  [2]Current 
> > > (dynamic)",1,2,1);
> > > 
> > > { Choice of Static/Dynamic last EOM signal }
> > > EOM:=If(EOM=2,Cum(1)=LastValue(Cum(1)),
> > >  DayOfMonth()=31);
> > > 
> > > { Start of month }
> > > start:=Month()<>Ref(Month(),-1) OR Cum(1)=2;
> > > 
> > > { End of month }
> > > end:=PeakBars(1,
> > >  -(start OR Cum(IsDefined(start))=1),1)=0
> > >  OR EOM;
> > > 
> > > { Plot signals in own window }
> > > signal:=start-end;
> > > 
> > > { Flag Month start and end }
> > > init:=Cum(IsDefined(start+end))=1;
> > > flag:=ValueWhen(1,start-end<>0 OR init,start);
> > > 
> > > Do you see where the problem is?
> > > When a new month begins, he starts to sum the volume for that 
> > > specific month. I cannot specified a time period for the sum of 
> the 
> > > volume because that time period is give by each day of the month.
> > > 
> > > Today is August 24, there is 16 tradind days so far in the month. 
> > Of 
> > > the 16 trading days, we have 6 days where the close was above the 
> > > previous days close and 10 days where the close was below the 
> > > previous days close.
> > > 
> > > So as a result, I want to sum the volume for those 6 updays as up 
> > > volume and sum the volume for those 10 downdays as down volume.
> > > 
> > > The problem here is on how to select those 6 and 10 days as our 
> > time 
> > > period for the Sum() function.
> > > 
> > > Did I make myself clear? This is a bit confuse to explain.
> > > 
> > > Regards
> > > 
> > > 
> > > 
> > > --- In equismetastock@xxxxxxxxxxxxxxx, "p_panther_73" <mchantzi@> 
> > > wrote:
> > > >
> > > > Preston,
> > > > 
> > > > The formula you gave can be simplified as follows:
> > > > 
> > > > 100-(100/(1+RS))=100*RS/(1+RS)=100*Z/Y/(1+Z/Y)=100*Z/(Z+Y).
> > > > 
> > > > Now, we can clearly see that under this simplified version, one 
> > can 
> > > > leave out the if condition for Y (since Z+Y>0).
> > > > What's more, since Z+Y is the total traded volume, one can 
> write 
> > > down:
> > > > 
> > > > tp:=14;
> > > > RapidRsiVol=100*SUM(v*(c>ref(c,-1),tp)/sum(v,tp)
> > > > 
> > > > (This one is taking in assumption that no days we'll have c=ref
> > (c,-
> > > > 1), anyway small difference it'll do.)
> > > > 
> > > > The thing is however, that this will plot as easily can see the 
> > > > fraction of traded volume for the up-days without taking in 
> > > > consideration if they were in a row, as Fernardo wished it to 
> be.
> > > > 
> > > > In the formula i presented, what is actually plotted is the sum 
> > of 
> > > > volume for those days that we had c>ref(c,-1) in a row.
> > > > As an example, let's say we have 3 days in a row where prices 
> > went 
> > > > up. This formula will sum the volume for these 3 particular 
> > trading 
> > > > days. But, if tomorrow price goes down, the formula will return 
> a 
> > > > zero.
> > > > Again, if i got correctly what was asked from the beginning.
> > > > 
> > > > Regards,
> > > > 
> > > > mc
> > > > 
> > > > --- In equismetastock@xxxxxxxxxxxxxxx, pumrysh <no_reply@> 
> wrote:
> > > > >
> > > > > Fernando,
> > > > > 
> > > > > Let's take a look at the Rapid RSI which is a none smoothed 
> > > > version. 
> > > > > Here it is:
> > > > > 
> > > > > Name: Rapid RSI
> > > > > Formula:
> > > > > tp:= 14; { time periods in RSI calculation}
> > > > > plot:= C;
> > > > > change:= ROC(plot,1,$);
> > > > > Z:=Sum(If(change>0,change,0),tp);
> > > > > Y:=Sum(If(change<0,Abs(change),0),tp);
> > > > > Ytemp:=If(y=0,0.00001,y);
> > > > > RS:=Z/Ytemp;
> > > > > 100-(100/(1+RS))
> > > > > 
> > > > > 
> > > > > In order to make the changes you want it would look like this:
> > > > > 
> > > > > Name: Rapid RSI Vol
> > > > > Formula:
> > > > > tp:= 14; { time periods in RSI calculation}
> > > > > plot:= C;
> > > > > change:= ROC(plot,1,$);
> > > > > Z:=Sum(If(change>0,Volume,0),tp);
> > > > > Y:=Sum(If(change<0,Abs(Volume),0),tp);
> > > > > Ytemp:=If(y=0,0.00001,y);
> > > > > RS:=Z/Ytemp;
> > > > > 100-(100/(1+RS))
> > > > > 
> > > > > Notice that the Z and Y variables are the sums you are 
> looking 
> > > for. 
> > > > Z 
> > > > > variable is positive and Y variable is negative. In the case 
> of 
> > > the 
> > > > > RSI it is then indexed.
> > > > > 
> > > > > Hope this helps.
> > > > > 
> > > > > Preston
> > > > > 
> > > > >  
> > > > > 
> > > > > 
> > > > > --- In equismetastock@xxxxxxxxxxxxxxx, "Fernando Santos" 
> > > > > <ptc_man3@> wrote:
> > > > > >
> > > > > > Which RSI pumrysh?
> > > > > > 
> > > > > > I found this two formulas:
> > > > > > 
> > > > > > Q:=Input("Time Periods",1,1000,14); 
> > > > > > 
> > > > > > B:=Input("Field: 1=Close, 2=Open, 3=High, 4=Low, 
> > > 5=Volume",1,5,1);
> > > > > > 
> > > > > > Z:=If(B=1,Wilders(If(ROC(C,1,$)>0,ROC(C,1,$),0),LastValue
> > (Q)),If
> > > > > > (B=2,Wilders(If(ROC(O,1,$)>
> > > > > > 0,ROC(O,1,$),0)LastValue(Q)),If(B=3,Wilders(If(ROC(H,1,$)
> > >0,ROC
> > > > > > (H,1,$),0),LastValue(Q)),
> > > > > > If(B=4,Wilders(If(ROC(L,1,$)>0,ROC (L,1,$),0),LastValue
> > > > (Q)),Wilders
> > > > > (If
> > > > > > (ROC(V,1,$)>0
> > > > > > ,ROC(V,1,$),0),LastValue(Q))))));
> > > > > > 
> > > > > > Y:=If(B=1,Wilders(If(ROC(C,1,$)<0,Abs(ROC
> (C,1,$)),0),LastValue
> > > > > (Q)),If
> > > > > > (B=2,Wilders(If(ROC
> > > > > > (O,1,$) <0,Abs(ROC(O,1,$)),0),LastValue(Q)),If(B=3,Wilders
> (If
> > > (ROC
> > > > > > (H,1,$)<0,Abs
> > > > > > (ROC(H,1,$)),0),LastValue(Q)),If(B=4,Wilders(If(ROC(L,1,$)
> > 0,Abs
> > > > (ROC
> > > > > > (L,1,$)),0),LastValue(Q))
> > > > > > ,Wilders(If(ROC(V,1, $)<0,Abs(ROC(V,1,$)),0),LastValue
> > (Q))))));
> > > > > > 
> > > > > > RS:=Z/Y;
> > > > > > 
> > > > > > 100-(100/(1+RS))
> > > > > > 
> > > > > > 
> > > > > > And this one:
> > > > > > 
> > > > > > 100 - 100/
> > > > > > (1.+ If(Mov(If(P-Ref(P,-1)<0,-(P-Ref(P,-1)),0),23,E)
> > > =0,1000000,Mov
> > > > > (If
> > > > > > (P-Ref(P,-1)>0, P-Ref(P,-1), 0),23,E) /Mov(If(P-Ref(P,-1)
> <0,-
> > (P-
> > > > Ref
> > > > > > (P,-1)),0),23,E)))
> > > > > > 
> > > > > > Maybe is the late hour that I'm writing this message but I 
> > > didn't 
> > > > > > understand your explanation
> > > > > > 
> > > > > > regards
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > --- In equismetastock@xxxxxxxxxxxxxxx, pumrysh <no_reply@> 
> > > wrote:
> > > > > > >
> > > > > > > Fernando,
> > > > > > > 
> > > > > > > Take a look at the RSI formula.
> > > > > > > Basically does what you want. To apply it to your 
> situation 
> > > you 
> > > > > > will 
> > > > > > > need to change to the sum of the volume instead of the 
> > close 
> > > > but 
> > > > > > > everything else would be the same.
> > > > > > > 
> > > > > > > Preston
> > > > > > > 
> > > > > > > --- In equismetastock@xxxxxxxxxxxxxxx, "Fernando Santos" 
> > > > > > > <ptc_man3@> wrote:
> > > > > > > >
> > > > > > > > Hi.
> > > > > > > > 
> > > > > > > > I'm having some problems with the Sum() and BarsSince()
> > > > function.
> > > > > > > > 
> > > > > > > > What I want is to Sum the volume if and only when c>ref
> > (c,-
> > > 1) 
> > > > > but 
> > > > > > > by
> > > > > > > > the numbers of bars of that variable.
> > > > > > > > 
> > > > > > > > Let me explain better, imagine that during this month, 
> > the 
> > > > > close 
> > > > > > > was
> > > > > > > > higher then the previous days close 12 times.
> > > > > > > > 
> > > > > > > > How can I say that I want to sum the volume for those 
> 12 
> > > > > specific 
> > > > > > > days
> > > > > > > > when I need to know the time periods for the sum 
> function?
> > > > > > > > 
> > > > > > > > Using barsince() doesn't seem to work since Sum() 
> doesn't 
> > > > > > recognize
> > > > > > > > the barssince() result as time periods.
> > > > > > > > 
> > > > > > > > Any ideas?
> > > > > > > > 
> > > > > > > > Thanks
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>



------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/equismetastock/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/equismetastock/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:equismetastock-digest@xxxxxxxxxxxxxxx 
    mailto:equismetastock-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    equismetastock-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/