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

Re: [amibroker] programmatic shut down/restart of Amibroker



PureBytes Links

Trading Reference Links




<FONT face=Arial color=#0000ff 
size=2>Rakesh,
<FONT face=Arial color=#0000ff 
size=2> 
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...
<FONT face=Arial color=#0000ff 
size=2> 
<FONT face=Arial color=#0000ff 
size=2>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 <FONT face=Arial 
color=#0000ff size=2>
/* WinMidas */
function<FONT color=#282828 
size=2> SR(numdays)
{ 
TP = ( <FONT 
face=Arial color=#0000ff>H<FONT 
color=#0000ff> + <FONT 
size=2>L<FONT 
size=2> + C<FONT 
face=Arial> ) / <FONT 
size=2>3<FONT face=Arial 
color=#0000ff> ;
pvol = TP * <FONT 
size=2>V<FONT color=#282828 
size=2> ;
cumpv = <FONT face=Arial 
color=#0000ff size=2>Cum<FONT face=Arial 
color=#0000ff>( pvol );
cumvol = <FONT 
face=Arial>Cum( 
V<FONT color=#282828 
size=2> ) ;
basecumpv = <FONT 
face=Arial>Ref( Cumpv, 
-numdays);//<FONT color=#008000 
size=2> numdays );
basecumvol = <FONT 
face=Arial>Ref( Cumvol, 
-numdays);//<FONT color=#008000 
size=2>numdays) ;
sr1= cumpv - basecumpv ;
sr2= Cumvol - basecumvol 
;
sr3<FONT 
color=#0000ff>=sr1/sr2 ;
 
return<FONT face=Arial 
color=#0000ff size=2> <FONT face=Arial 
color=#0000ff>sr3;
}<FONT color=#282828 
size=2>
PDS1=<FONT face=Arial 
size=2>Param("1st 
SR line",<FONT face=Arial 
size=2>10,<FONT face=Arial 
size=2>1,<FONT face=Arial 
size=2>500,<FONT face=Arial 
size=2>1<FONT 
color=#0000ff>);
PDS2=<FONT face=Arial 
size=2>Param("2nd 
SR Line",<FONT face=Arial 
size=2>50,<FONT face=Arial 
size=2>1,<FONT face=Arial 
size=2>500,<FONT face=Arial 
size=2>1);<FONT 
color=#0000ff size=2>
Plot<FONT color=#282828 
size=2>(SR(pds1)<FONT color=#282828 
size=2>,""<FONT color=#282828 
size=2>,colorRed<FONT 
color=#282828 size=2>,1<FONT 
color=#282828 size=2>) ;<FONT face=Arial color=#0000ff 
size=2>
Plot(SR(pds2),<FONT 
face=Arial color=#ff00ff size=2>""<FONT face=Arial color=#282828 
size=2>,colorBlue<FONT face=Arial 
color=#282828 size=2>,1<FONT 
face=Arial color=#282828 size=2>);
Plot<FONT color=#282828 
size=2>(C<FONT 
color=#282828 size=2>,""<FONT 
color=#282828 size=2>,colorBlack<FONT 
face=Arial>,<FONT 
size=2>styleBar) 
;
Title<FONT 
color=#0000ff> ="Number of Days Past 
"+WriteVal<FONT 
size=2>(LastValue(<FONT 
size=2>BarIndex())-BarIndex<FONT 
size=2>(),1.0)+ 
EncodeColor(<FONT 
size=2>colorDarkBlue) + <FONT 
size=2>FullName() + " ["<FONT 
size=2> + Name() + <FONT 
size=2>"] " +<FONT 
color=#0000ff size=2>
WriteVal<FONT color=#282828 
size=2>(DateTime<FONT color=#282828 
size=2>(),formatDateTime<FONT 
face=Arial>) + <FONT color=#ff00ff 
size=2>"\n" +<FONT 
color=#0000ff size=2>
EncodeColor<FONT 
color=#282828 size=2>(colorBrown<FONT 
face=Arial>) + <FONT color=#ff00ff 
size=2>"WinMidas Support/Resistance"<FONT color=#282828 
size=2>;

  <FONT face=Tahoma 
  size=2>-----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 = <FONT 
  color=#0000ff size=2>Param(<FONT color=#ff00ff 
  size=2>"Enter the Month - MM",<FONT color=#ff00ff 
  size=2>1,1<FONT 
  size=2>,12<FONT 
  face="Courier New">);eDate = <FONT color=#0000ff 
  size=2>Param("Enter the 
  Date - DD",1<FONT 
  size=2>,1,<FONT 
  color=#ff00ff size=2>31<FONT 
  size=2>);eYear = Param<FONT 
  size=2>("Enter the Year - YYYY"<FONT 
  size=2>,2004<FONT 
  size=2>,1980<FONT 
  size=2>,2100<FONT 
  face="Courier New">);DateNo = (eYear - <FONT 
  color=#ff00ff size=2>1900) * <FONT color=#ff00ff 
  size=2>10000 + eMonth * <FONT color=#ff00ff 
  size=2>100 + eDate 
  ;numdays = BarsSince<FONT 
  size=2>(DateNum<FONT 
  face="Courier New">() == DateNo ) ;TP = ( H + 
  L + C ) / 3<FONT 
  face="Courier New"> ;pvol = TP * V ;cumpv = 
  Cum<FONT 
  face="Courier New">( pvol );cumvol = <FONT 
  color=#0000ff size=2>Cum( 
  V ) ;basecumpv = <FONT color=#0000ff 
  size=2>ValueWhen( numdays == <FONT color=#ff00ff 
  size=2>1, <FONT color=#0000ff 
  size=2>Ref( Cumpv, -<FONT color=#ff00ff 
  size=2>1 ), <FONT color=#ff00ff 
  size=2>1 ) ;basecumvol 
  = ValueWhen( numdays == 
  1, <FONT 
  color=#0000ff size=2>Ref( Cumvol, -<FONT 
  color=#ff00ff size=2>1 ), <FONT color=#ff00ff 
  size=2>1 ) ;sr1 = 
  cumpv - basecumpv ;sr2 = Cumvol - basecumvol ;sr = sr1 / sr2 
  ;Plot<FONT 
  size=2>(sr,""<FONT 
  face="Courier New">,colorRed,styleLine) 
  ;Plot<FONT 
  size=2>(C,""<FONT 
  face="Courier New">,colorBlack,styleBar) 
  ;Title =  <FONT color=#0000ff 
  size=2>EncodeColor(colorDarkBlue) + <FONT 
  color=#0000ff size=2>FullName() + <FONT 
  color=#ff00ff size=2>"   [" + <FONT 
  color=#0000ff size=2>Name() + <FONT color=#ff00ff 
  size=2>"]   " 
  +WriteVal<FONT 
  size=2>(DateTime<FONT 
  size=2>(),formatDateTime) +  <FONT color=#ff00ff 
  size=2>"\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:
  <BLOCKQUOTE class=replbq 
  >
    
    <FONT face=Arial color=#0000ff 
    size=2>Rakesh,
    <FONT face=Arial color=#0000ff 
    size=2>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<FONT 
    color=#282828 size=2> 
    T3(price,periods,s)
    {
    e1=<FONT face=Arial 
    color=#0000ff size=2>EMA<FONT face=Arial 
    color=#0000ff>(price,periods);
    e2=<FONT face=Arial 
    color=#0000ff size=2>EMA<FONT face=Arial 
    color=#0000ff>(e1,Periods);
    e3=<FONT face=Arial 
    color=#0000ff size=2>EMA<FONT face=Arial 
    color=#0000ff>(e2,Periods);
    e4=<FONT face=Arial 
    color=#0000ff size=2>EMA<FONT face=Arial 
    color=#0000ff>(e3,Periods);
    e5=<FONT face=Arial 
    color=#0000ff size=2>EMA<FONT face=Arial 
    color=#0000ff>(e4,Periods);
    e6=<FONT face=Arial 
    color=#0000ff size=2>EMA<FONT face=Arial 
    color=#0000ff>(e5,Periods);
    c1=-s*s*s;
    c2=<FONT 
    color=#0000ff>3*s*s+<FONT 
    size=2>3<FONT face=Arial 
    color=#0000ff>*s*s*s;
    c3=-<FONT 
    color=#0000ff>6*s*s-<FONT 
    size=2>3*s-<FONT 
    size=2>3<FONT face=Arial 
    color=#0000ff>*s*s*s;
    c4=<FONT 
    color=#0000ff>1+<FONT 
    size=2>3*s+s*s*s+<FONT 
    size=2>3<FONT face=Arial 
    color=#0000ff>*s*s;
    <FONT face=Arial 
    color=#0000ff>Ti3=c1*e6+c2*e5+c3*e4+c4*e3;<FONT 
    color=#800000 size=2>
    return<FONT color=#282828 
    size=2> ti3;
    }
    pd1=<FONT 
    color=#0000ff>Param(<FONT 
    size=2>"Long",40<FONT 
    size=2>,10,<FONT 
    size=2>100,<FONT 
    size=2>1<FONT face=Arial 
    color=#0000ff>);
    pd2=<FONT 
    color=#0000ff>Param(<FONT 
    size=2>"Short" ,10<FONT 
    size=2>,5,<FONT 
    size=2>50,1<FONT 
    color=#282828 size=2>);<FONT color=#0000ff 
size=2>
    Plot<FONT color=#282828 
    size=2>(t3(C<FONT 
    color=#282828 size=2>,pd1,.71),"T3 
    " +<FONT color=#ff00ff 
    size=2>"("+<FONT color=#0000ff 
    size=2>WriteVal(pd1,<FONT 
    color=#ff00ff size=2>1.0)+<FONT 
    color=#ff00ff size=2>")",<FONT 
    size=2>colorYellow<FONT color=#282828 
    size=2>,1<FONT color=#282828 
    size=2>|styleThick<FONT 
    color=#282828 size=2>);<FONT 
    color=#0000ff size=2>
    Plot<FONT color=#282828 
    size=2>(t3(C<FONT 
    color=#282828 size=2>,pd2,.74),<FONT color=#ff00ff 
    size=2>"T3" +<FONT color=#ff00ff 
    size=2>"("+<FONT color=#0000ff 
    size=2>WriteVal(pd2,<FONT 
    color=#ff00ff size=2>1.0)+<FONT 
    color=#ff00ff size=2>")",<FONT 
    size=2>colorBlue<FONT color=#282828 
    size=2>,1<FONT color=#282828 
    size=2>|styleThick<FONT 
    color=#282828 size=2>);
    
      <FONT face=Tahoma 
      size=2>-----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 - <A 
      href="">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: 
      <A 
      href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
      group FAQ at: <A 
      href="">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: <A 
      href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
      
  
  
  Do you Yahoo!?Yahoo! Tax Center - <A 
  href="">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: <A 
  href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
  group FAQ at: <A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
  


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.