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

[amibroker] how do u make a function stores variables for an individual equity not workspace



PureBytes Links

Trading Reference Links


Please drag the below formula onto a share .
Set the date of yre trade and adjust the price to the bought price.
Set the STOP LOSS % and TRAIL PROFIT STOP.
I developed it to keep a tab of 

a) Highest (since trade date) - 33% level: a running 33% PROFIT STOP 

b) TRADE entry level - dashed line

This tool helps input INITSTOP loss and Profit TRAILING STOP data into
my trade platform but I am having difficulty getting it to work as I
want .

The problem is when I adjust the date and trade amount parameter on
say msft changing to the next traded equity has the changed paramter
data as well. So all trades adjust to the same date . I have 10xtrades
i want to continously monitor STOP and PROFIT EXITS. I  cannot think
of how scan, explore or Functions can store individual entry dates and
 buy prices .

I want this function to have its parameters set according to the
EQUITY not the worksheet . What I need is to overlay this Function
into a OHCL window and have it customizable like say a drawn line . A
drawn line is  individual to the stock your drawing on. When you
change the equity the drawline does not follow onto the next worksheet
display. If you have drawn 2 lines ,one on each equity they appear
seperate and do not affect each other. The param function doesnt seem
to have a global or individual setting for equities. 
Maybe I have missed some way to do this but what comes to mind is a
variable like Local_param that adjusts to the equity only.

Is there anyway I can do this without asking for a software upgrade  ?

Thanks

Maurice


//--------------------------------8<-------------------------------

Title = " zMF_HLV_AP_exitSTOP" ;

//calc DATE PARAMS

ppDd = Param( "PPday", 5, 1, 31,1 ) ;

ppMm = Param( "PP Month", 01, 1, 12,1 ) ;

ppyy = Param( "PP Year", 2005, 1900, 2050,1 ) ;

///calc when to print LINE starting from date of trade

rightday = IIf( Year() == ppyy AND Month() == ppmm AND Day() == ppdd
,1 , 0 ) ; 

rightdaylatch = Cum( IIf( Year() == ppyy AND Month() == ppmm AND Day()
== ppdd ,1 , 0 ) ) ; 

Hipoint = HighestSince( rightday == 1, H , 1) ;// calc highest point
since trade date

vw = ValueWhen( rightday == 1 , C , 1 ) ;// value of close since TRADE
date



PrPaid = Param( "PricePAID adjust +/- from the close ", 0, -100, 100,
0.01 ) ;// allows adjustmet of price paid from close

prpaid = prpaid + VW ; 

INSTOP= Param( "Initi STOP %", 20, 0, 100, 1 ) ; //SET INIT STOP as 20%
TRSTOP= Param( "TRAIL STOP %", 33, 0, 100, 1 ) ; //SET TRAIL STOP as 20%

Pricepaid = IIf( rightdaylatch == 1 ,prpaid , Null ) ;// make valid if
the date > TRADE date

TRAILSTOP = Hipoint * ( 100 - TRstop )/100 ; // calc 33% TRAILING
Profit STOP
INITSTOP = Pricepaid * ( 100 - instop )/100 ; // calc 20% INTI_STOP

//|||||||||||||||||||||____PLOT____|||||||||||||||||||||||||||||||||||||||||||||||||||||

piccolor = ParamColor("pricepaid", colorLightGrey ) ; 

piccolor1 = ParamColor("INITSTOP", colorRed ) ; 
piccolor2 = ParamColor("TRAIL STOP", colorGreen) ; 

Plot( pricepaid,"Price Paid",piccolor,styleDashed ) ;

Plot( initstop,"INIT STOP",piccolor1,styleLine ) ;

Plot( trailSTOP,"TRAIL STOP",piccolor2,styleLine ) ;
//--------------------------------8<-------------------------------


> 
> thanks for reading
> 
> Regards,
> Maurice
> australia
> 
> 





------------------------ Yahoo! Groups Sponsor --------------------~--> 
In low income neighborhoods, 84% do not own computers.
At Network for Good, help bridge the Digital Divide!
http://us.click.yahoo.com/EpW3eD/3MnJAA/cosFAA/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/