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

[amibroker] Re: Vertical Line



PureBytes Links

Trading Reference Links


Jayson
 
Thanks for the code. There is an obvious flaw in it. It is giving the number of bars to the right of the chosen pivot instead of the bars to the left as it should- atleast that is my understanding. Rather than ask you to do the code for me, if it is not inconvenient could you guide me through the process? I understand it will take time given the various constraints on your time. However if you can guide me I will better understand how you approach the problem rather than just enjoy the fruits of your labor.
 
Regards
 
Rakesh
Jayson <jcasavant@xxxxxxxxxxx> wrote:


Rakesh,
 
Here is a first draft that you may find workable. The top 5 lines of your code are designed to count bars. Rather than going to the trouble of entering the date instead you may simply click on the bar you with to start the study from and you will see the number of bars back listed in the title line of the chart. Take that number and enter it in the function...
 
example  SR(50) will plot your code for the last 50 bars. Since you are eyeballing the chart it should be easy to find the important data points. In your plot lines simply add the appropriate numbers  I have not tested the code but simply made a function of the code you posted.... 
Regards,Jayson 
/* WinMidas */
function SR(numdays)
{ 
TP = ( H + L + C ) / 3 ;
pvol = TP * V ;
cumpv = Cum( pvol );
cumvol = Cum( V ) ;
basecumpv = Ref( Cumpv, -numdays);// numdays );
basecumvol = Ref( Cumvol, -numdays);//numdays) ;
sr1= cumpv - basecumpv ;
sr2= Cumvol - basecumvol ;
sr3=sr1/sr2 ;
 
return sr3;
}
PDS1=Param("1st SR line",10,1,500,1);
PDS2=Param("2nd SR Line",50,1,500,1);
Plot(SR(pds1),"",colorRed,1) ;
Plot(SR(pds2),"",colorBlue,1);
Plot(C,"",colorBlack,styleBar) ;
Title ="Number of Days Past "+WriteVal(LastValue(BarIndex())-BarIndex(),1.0)+ EncodeColor(colorDarkBlue) + FullName() + " [" + Name() + "] " +
WriteVal(DateTime(),formatDateTime) + "\n" +
EncodeColor(colorBrown) + "WinMidas Support/Resistance";

-----Original Message-----From: Rakesh Sahgal [mailto:rakeshsahgal@xxxxxxxxx]Sent: Wednesday, April 14, 2004 12:48 PMTo: amibroker@xxxxxxxxxxxxxxxSubject: RE: [amibroker] Param Question
Jayson,
 
Thanks for the response.
 
Let me put the problem in perspective. Maybe then you can understand what I need and tell me if it is possible with my rudimentary programming skills.
 
I am working on the MIDAS method.
 
The support/resistance lines are date specific i.e. launched from specific dates which are user selected by eye balling the chart.
 
I had written the code for this in MS which HarveyHP was kind enough to ammend for use with Amibroker. The code is appended below for your examination. 
MIDAS CODE FOR AB
 
/*   WinMidas   */eMonth = Param("Enter the Month - MM",1,1,12);eDate = Param("Enter the Date - DD",1,1,31);eYear = Param("Enter the Year - YYYY",<FONT color=#ff00ff
 size=2>2004,1980,2100);DateNo = (eYear - 1900) * 10000 + eMonth * 100 + eDate ;numdays = BarsSince(DateNum() == DateNo ) ;TP = ( H + L + C ) / 3 ;pvol = TP * V ;cumpv = Cum( pvol );cumvol = Cum<FONT
 size=2>( V ) ;basecumpv = ValueWhen( numdays == 1, Ref( Cumpv, -1 ), 1 ) ;basecumvol = ValueWhen( numdays == 1, Ref( Cumvol, -1 ), 1 ) ;sr1 = cumpv - basecumpv ;sr2 = Cumvol - basecumvol ;sr = sr1 / sr2 ;Plot(sr,""<FONT
 size=2>,colorRed,styleLine) ;Plot(C,"",colorBlack,styleBar) ;Title =  EncodeColor(colorDarkBlue) + FullName() + "   [" + Name() + "]   " +WriteVal(DateTime(),formatDateTime) +  "\n" +EncodeColor<FONT
 size=2>(colorBrown) + "WinMidas Support/Resistance";
====================================
 
Now as you can see it allows for only one launch of a S/R level.. This code needs to be ammended so, that several SR levels can be launched from differing dates.
 
I will appreciate your comments on the workability of what I am trying to do per se and also in context of programming skills necessary for undertaking this exercise.
 
Regards
 
 
Rakesh
Jayson <jcasavant@xxxxxxxxxxx> wrote:


Rakesh,
One way would be to make your indicator a function then call the function as many times as you wish in as many plot statements as you need. Here is an example of a function for the tillson indicator that was discussed at length by Dt a few weeks ago. Note the plot lines at the end of the code where Ti3 is called using different parameters....
 
Regards,Jayson 
 
//the Ti3 average
function T3(price,periods,s)
{
e1=EMA(price,periods);
e2=EMA(e1,Periods);
e3=EMA(e2,Periods);
e4=EMA(e3,Periods);
e5=EMA(e4,Periods);
e6=EMA(e5,Periods);
c1=-s*s*s;
c2=3*s*s+3*s*s*s;
c3=-6*s*s-3*s-3*s*s*s;
c4=1+3*s+s*s*s+3*s*s;
Ti3=c1*e6+c2*e5+c3*e4+c4*e3;
return ti3;
}
pd1=Param("Long",40,10,100,1);
pd2=Param("Short" ,10,5,50,1);
Plot(t3(C,pd1,.71),"T3 " +"("+WriteVal(pd1,1.0)+")",colorYellow,1|styleThick);
Plot(t3(C,pd2,.74),"T3" +"("+WriteVal(pd2,1.0)+")",colorBlue,1|styleThick);

-----Original Message-----From: Rakesh Sahgal [mailto:rakeshsahgal@xxxxxxxxx]Sent: Tuesday, April 13, 2004 10:50 PMTo: amibroker@xxxxxxxxxxxxxxxSubject: [amibroker] Param Question
Group
 
Can someone please explain how I should go about plotting multiple instances of an indicator with differing parameters in the same chart pane?
 
In simple words lets say an oscillator of EMAs' of periodicities 3&10, 5&35 etc etc.The paremters are not predefined but are manually entered.
 
TIA
 
Rakesh
 
 


Do you Yahoo!?Yahoo! Tax Center - File online by April 15th Send BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to suggest@xxxxxxxxxxxxx-----------------------------------------Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html Send BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to suggest@xxxxxxxxxxxxx-----------------------------------------Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A
 href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 


Do you Yahoo!?Yahoo! Tax Center - File online by April 15th Send BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to suggest@xxxxxxxxxxxxx-----------------------------------------Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html Send BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to suggest@xxxxxxxxxxxxx-----------------------------------------Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A
 href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
		Do you Yahoo!?
Yahoo! Tax Center - File online by April 15th


Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html








Yahoo! Groups Links
To visit your group on the web, go to:http://groups.yahoo.com/group/amibroker/ 
To unsubscribe from this group, send an email to:amibroker-unsubscribe@xxxxxxxxxxxxxxx 
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.