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

[amibroker] Multile files Import



PureBytes Links

Trading Reference Links




<FONT face=Arial color=#0000ff 
size=2>Rakesh,
I 
found the number of bars that have elapsed since the pivot by calculating the 
last valve of barindex() and subtracting the value at the pivot. If you want to 
simply know how many total bars have elapsed  at the pivot from day one 
then use  Barindex(),  So in the title line use
<FONT face=Arial color=#0000ff 
size=2> 
 
Title ="Number of Days 
Past "+WriteVal(BarIndex()+1,1.0)+ 
EncodeColor(colorDarkBlue) + FullName() + " [" + Name() + "] 
" 
+
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>;
 
Of 
course you will also need to adjust the MAX value in the parameter line to more 
accurately reflect the total number of bars you collect. I am not so sure this 
is really what you want though... Consider the lines
<FONT face=Arial color=#0000ff 
size=2> 

basecumpv = <FONT 
color=#0000ff>Ref( Cumpv, -<FONT 
size=2>numdays);// numdays 
);
basecumvol = <FONT 
face=Arial>Ref( Cumvol, 
-numdays);//<FONT color=#008000 
size=2>numdays) ;
<FONT color=#008000 
size=2> 
<SPAN 
class=769492821-15042004>if you enter the 
number of days to the left then you are really asking for the value of cumpv on 
day 1 and the value of cumvol on day 1. I am not familiar with winmidas so I 
could perhaps be wrong....hopefully the exercise at least showed you the value 
of being able to create your own 
functions..
<FONT face=Arial color=#0000ff 
size=2> 
Regards,Jayson 

  <FONT face=Tahoma 
  size=2>-----Original Message-----From: Rakesh Sahgal 
  [mailto:rakeshsahgal@xxxxxxxxx]Sent: Thursday, April 15, 2004 11:27 
  AMTo: amibroker@xxxxxxxxxxxxxxxSubject: RE: [amibroker] 
  Param Question
  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:
  <BLOCKQUOTE class=replbq 
  >
    
    <FONT face=Arial color=#0000ff 
    size=2>Rakesh,
    <FONT face=Arial color=#0000ff 
    size=2> 
    <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 
    size=2>H<FONT 
    face=Arial> + <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 );<FONT 
    color=#282828 size=2>
    basecumvol = <FONT 
    face=Arial>Ref( Cumvol, 
    -numdays);//<FONT 
    color=#008000 size=2>numdays) ;<FONT 
    color=#282828 size=2>
    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(<FONT 
    face=Arial size=2>"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(<FONT 
    face=Arial size=2>"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 face=Arial color=#282828 
    size=2>);
    Plot<FONT color=#282828 
    size=2>(SR(pds1)<FONT color=#282828 
    size=2>,""<FONT color=#282828 
    size=2>,colorRed<FONT 
    face=Arial>,<FONT color=#ff00ff 
    size=2>1) ;<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>,<FONT face=Arial color=#ff00ff 
    size=2>1);<FONT 
    color=#0000ff size=2>
    Plot<FONT color=#282828 
    size=2>(C<FONT 
    color=#282828 size=2>,""<FONT 
    color=#282828 size=2>,<FONT 
    size=2>colorBlack<FONT color=#282828 
    size=2>,styleBar<FONT color=#282828 
    size=2>) ;
    Title<FONT 
    face=Arial> ="Number of 
    Days Past "+WriteVal<FONT 
    size=2>(LastValue(<FONT 
    size=2>BarIndex())-<FONT 
    size=2>BarIndex(),1.0<FONT 
    size=2>)+ EncodeColor<FONT 
    size=2>(colorDarkBlue) + 
    FullName() + " 
    [" + Name() + 
    "] " 
    +
    WriteVal<FONT 
    color=#282828 size=2>(DateTime<FONT 
    color=#282828 size=2>(),<FONT 
    size=2>formatDateTime<FONT color=#282828 
    size=2>) + "\n"<FONT color=#282828 
    size=2> +
    EncodeColor<FONT 
    color=#282828 size=2>(<FONT 
    size=2>colorBrown<FONT color=#282828 
    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,<FONT color=#ff00ff 
      size=2>1,<FONT color=#ff00ff 
      size=2>12);eDate = 
      Param(<FONT 
      color=#ff00ff size=2>"Enter the Date - DD"<FONT 
      size=2>,1<FONT 
      size=2>,1<FONT 
      size=2>,31<FONT 
      face="Courier New">);eYear = <FONT color=#0000ff 
      size=2>Param("Enter 
      the Year - YYYY",<FONT color=#ff00ff 
      size=2>2004,<FONT color=#ff00ff 
      size=2>1980,<FONT color=#ff00ff 
      size=2>2100<FONT 
      size=2>);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 ) / <FONT color=#ff00ff 
      size=2>3 ;pvol = 
      TP * V ;cumpv = <FONT color=#0000ff 
      size=2>Cum( pvol 
      );cumvol = Cum<FONT 
      face="Courier New">( V ) ;basecumpv = <FONT 
      color=#0000ff size=2>ValueWhen( numdays == 
      1, <FONT 
      color=#0000ff size=2>Ref( Cumpv, -<FONT 
      color=#ff00ff size=2>1 ), <FONT color=#ff00ff 
      size=2>1 ) 
      ;basecumvol = ValueWhen<FONT 
      size=2>( numdays == 1<FONT 
      size=2>, Ref( 
      Cumvol, -1 ), 
      1<FONT 
      face="Courier New"> ) ;sr1 = cumpv - basecumpv 
      ;sr2 = Cumvol - basecumvol ;sr = sr1 / sr2 ;<FONT 
      color=#0000ff size=2>Plot(sr,<FONT 
      color=#ff00ff size=2>""<FONT 
      size=2>,colorRed,styleLine) ;<FONT color=#0000ff 
      size=2>Plot(C,<FONT color=#ff00ff 
      size=2>""<FONT 
      size=2>,colorBlack,styleBar) ;Title =  
      EncodeColor<FONT 
      size=2>(colorDarkBlue) + <FONT color=#0000ff 
      size=2>FullName() + <FONT color=#ff00ff 
      size=2>"   [" + <FONT color=#0000ff 
      size=2>Name() + <FONT color=#ff00ff 
      size=2>"]   "<FONT 
      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 
        face=Arial>3<FONT 
        size=2>*s*s+3<FONT 
        color=#282828 size=2>*s*s*s;
        c3=-<FONT 
        face=Arial>6<FONT 
        size=2>*s*s-3*s-<FONT 
        size=2>3<FONT face=Arial 
        color=#0000ff>*s*s*s;
        c4=<FONT 
        face=Arial>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 
        face=Arial>Param<FONT 
        size=2>("Long",<FONT 
        size=2>40,10<FONT 
        size=2>,100,<FONT 
        size=2>1<FONT face=Arial 
        color=#0000ff>);
        pd2=<FONT 
        face=Arial>Param<FONT 
        size=2>("Short" ,<FONT 
        size=2>10,5<FONT 
        size=2>,50,<FONT 
        size=2>1<FONT color=#282828 
        size=2>);
        Plot<FONT 
        color=#282828 size=2>(t3(C<FONT 
        face=Arial>,pd1,.71),<FONT 
        color=#ff00ff size=2>"T3 " 
        +"("<FONT color=#282828 
        size=2>+WriteVal<FONT 
        color=#282828 size=2>(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 
        face=Arial>,pd2,.74),<FONT 
        color=#ff00ff size=2>"T3" 
        +"("<FONT color=#282828 
        size=2>+WriteVal<FONT 
        color=#282828 size=2>(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@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.