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

RE: [amibroker] custom indicator question



PureBytes Links

Trading Reference Links

Hi.  I use an approach similar to Antonio's except mine is based on types of
symbols, not specific symbols.  Standard symbols ("Price" below) are one
type, "Mutual Funds" are another type, "Index" is a third type.

In a chart I have this function to plot the MA:

PlotMA(Name(), "Price", C, "Short");

In my Include file I have two functions - PlotMA and MAPeriodsGet.
MAPeriodsGet, gets the number of periods based on the type.   PlotMA calls
MAPeriodsGet and then plots the MA.    The code is below.   Note that I have
several types of ATC symbols (Money Flow, AD, New Hi/Low) that do NOT have
the MA plotted.   That's what the "if(CurSymbolType == ..." code is for.

I hope this helps.

Regards,

Dan.

 
function PlotMA(Symbol, CurSymbolType, Field, MALengthCategory)
   {
   //Get Num MA Periods
   MAPeriods =  MAPeriodsGet(Symbol, CurSymbolType, MALengthCategory);

   //Title
   if(MALengthCategory == "Tiny")
      MATitle = "Tiny MA";
   else if(MALengthCategory == "Short")
      MATitle = "Short MA";
   else if(MALengthCategory == "Mid")
      MATitle = "Mid MA";
   else if(MALengthCategory == "Long")
      MATitle = "Long MA";
   else if(MALengthCategory == "Very Long")
      MATitle = "Very Long MA";

   //Now Plot the pup IF this is a price or index, otherwise NOT
   if (CurSymbolType  == "Price" OR CurSymbolType  == "Index" OR
CurSymbolType  == "MutualFund" )               
      {
      Plot( MA( C, MAPeriods ), MATitle + "(" + NumToStr(MAPeriods , 1.0) +
")", ParamColor( "Color", colorCycle ), ParamStyle("Style") + styleNoRescale
+ styleNoLabel ); 
      }
     }


function MAPeriodsGet(Symbol, SymbolType, MALengthCategory)
   {
   /*
   ** Return an MA number of periods given the type of symbol.
   ** and MALengthCategory
   */
   Periods = 0;
   if (SymbolType == "Price" )
      {
      if(MALengthCategory == "Tiny")
         Periods = 4;
      if(MALengthCategory == "Short")
         Periods = 10;
      else if(MALengthCategory == "Mid")
         Periods = 21;
      else if(MALengthCategory == "Long")
         Periods = 50;
      else if(MALengthCategory == "Very Long")
         Periods = 200;
      }
   else if (SymbolType == "MutualFund" )
      {
      if(MALengthCategory == "Short")
         Periods = 20;
      else if(MALengthCategory == "Mid")
         Periods = 50;
      else if(MALengthCategory == "Long")
         Periods = 185;
      else if(MALengthCategory == "Very Long")
         Periods = 325;
      }
   else if (SymbolType == "Index" )
      {
      if (   StrLeft(Symbol, 12) == "~Index_USMkt" 
         OR StrLeft(Symbol, 12) == "~Index_ADRMkt"
         OR StrLeft(Symbol, 1)  == "!")
         {
         //Standard Indexes
         if(MALengthCategory == "Short")
            Periods = 30;
         else if(MALengthCategory == "Mid")
            Periods = 50;
         else if(MALengthCategory == "Long")
            Periods = 185;
         else if(MALengthCategory == "Very Long")
            Periods = 325;
         }
      else
         {
         //Sector or industry Indices
         if(MALengthCategory == "Short")
            Periods = 20;
         else if(MALengthCategory == "Mid")
            Periods = 50;
         else if(MALengthCategory == "Long")
            Periods = 150;
         else if(MALengthCategory == "Very Long")
            Periods = 225;
         } 
      }
   else
      Periods = 0;

   return Periods ;
   }


From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf
Of Antonio Marra
Sent: Thursday, November 03, 2005 5:16 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: RE: [amibroker] custom indicator question

Hi,

Are You searching for a solution like this one?

Regards,
      Antonio


//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

//if You want to create a 3rd list, simply add a statement
//like this and another "else if...".

List_1 = Name() == "^AORD" OR 
         Name() == "^N225" OR
         Name() == "^AFLI";


List_2 = Name() == "AAC.AX" OR 
         Name() == "AAT.AX";




List_1_MA = Param("MA List 1",20,2,1000,1);
List_2_MA = Param("MA List 2",30,2,1000,1);
Others_MA = Param("MA Others",40,2,1000,1);

if (List_1)
{
PER = List_1_MA;
}
else if (List_2)
{
PER = List_2_MA;
}
else
{
PER = Others_MA;
}

Plot(MA(C,PER),"MOV AVG("+PER+")",colorRed,styleLine);

//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX




-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf
Of rasepi
Sent: Thursday, November 03, 2005 11:50 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] custom indicator question

for one custom sheet
example "moving average"
how can i personalize a different period for different stocks
ex for gnbt i will show a 10 ma
   for nvax i will show a 12 ma 
it is possible?

when I choose a period with Param its allways the same for all stocks
    thanks for the experts that helps the beginners

i am on the way to finalise the float channel indicator without vbscript
the float must be parametred manually for each stock

i will share the code when finished






Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html


Yahoo! Groups Links









      

      
            
___________________________________ 
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB 
http://mail.yahoo.it


Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html




SPONSORED LINKS 
Investment management software
<http://groups.yahoo.com/gads?t=ms&k=Investment+management+software&w1=Inves
tment+management+software&w2=Real+estate+investment+software&w3=Investment+p
roperty+software&w4=Software+support&w5=Real+estate+investment+analysis+soft
ware&w6=Investment+analysis+software&c=6&s=209&.sig=7eLbIobNLPiaCdUon6xw5w>
Real estate investment software
<http://groups.yahoo.com/gads?t=ms&k=Real+estate+investment+software&w1=Inve
stment+management+software&w2=Real+estate+investment+software&w3=Investment+
property+software&w4=Software+support&w5=Real+estate+investment+analysis+sof
tware&w6=Investment+analysis+software&c=6&s=209&.sig=qVIy7aeMM52465dBhias7w>
Investment property software
<http://groups.yahoo.com/gads?t=ms&k=Investment+property+software&w1=Investm
ent+management+software&w2=Real+estate+investment+software&w3=Investment+pro
perty+software&w4=Software+support&w5=Real+estate+investment+analysis+softwa
re&w6=Investment+analysis+software&c=6&s=209&.sig=lHCxQveBvqqJN_C2-8J8yw>

Software support
<http://groups.yahoo.com/gads?t=ms&k=Software+support&w1=Investment+manageme
nt+software&w2=Real+estate+investment+software&w3=Investment+property+softwa
re&w4=Software+support&w5=Real+estate+investment+analysis+software&w6=Invest
ment+analysis+software&c=6&s=209&.sig=-fzwVY_vCOoY7G2TwUPN7w>  	Real estate
investment analysis software
<http://groups.yahoo.com/gads?t=ms&k=Real+estate+investment+analysis+softwar
e&w1=Investment+management+software&w2=Real+estate+investment+software&w3=In
vestment+property+software&w4=Software+support&w5=Real+estate+investment+ana
lysis+software&w6=Investment+analysis+software&c=6&s=209&.sig=2hBKzxWX871GuN
wCwK7E_Q>  	Investment analysis software
<http://groups.yahoo.com/gads?t=ms&k=Investment+analysis+software&w1=Investm
ent+management+software&w2=Real+estate+investment+software&w3=Investment+pro
perty+software&w4=Software+support&w5=Real+estate+investment+analysis+softwa
re&w6=Investment+analysis+software&c=6&s=209&.sig=tdsnvsyEa54tWePPTX538Q>



YAHOO! GROUPS LINKS 

*	 Visit your group "amibroker
<http://groups.yahoo.com/group/amibroker> " on the web.
  
*	 To unsubscribe from this group, send an email to:
 amibroker-unsubscribe@xxxxxxxxxxxxxxx
<mailto:amibroker-unsubscribe@xxxxxxxxxxxxxxx?subject=Unsubscribe> 
  
*	 Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
<http://docs.yahoo.com/info/terms/> . 




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Try Online Currency Trading with GFT. Free 50K Demo. Trade 
24 Hours. Commission-Free. 
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.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:
    http://docs.yahoo.com/info/terms/
 

<<attachment: winmail.dat>>