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

[amibroker] Re: Getting AB to keep TABS of yre TRADE once active



PureBytes Links

Trading Reference Links


Your buy is never exact and so you need to enter a price adjustment
for it. thats why I wanted to use param. BUT , Param alters all
equities in that window worksheet . You cant say have param = 5.55 for
stock 1 and flick to next stock and that param be 3.45. 

Thats why I had to use drawn line  because lines are independant for
each stock. Thank god I could reference it with the study command ...
:-). It would be nice if a local param say LOCPARAM was able to be
used local for the individual equity only 

Regards
Moz


--- In amibroker@xxxxxxxxxxxxxxx, "sebastiandanconia"
<sebastiandanconia@xxxx> wrote:
> 
> I must be really dense on this.:)  If you use ValueWhen() to get the 
> price when your "buy" condition is met it should capture that price 
> and remember it for each stock in your scan, assuming you used the 
> same entry condition. If you use the same stop/stop-loss methods on 
> all your stocks you should be able to apply those calculations to the 
> ValueWhen() price for each stock.  Then use a filter that tells you 
> when the closing price crosses above/below the appropriate stop-loss 
> level you've calculated off of the ValueWhen() price.
> 
> I must be misunderstanding either the problem of what you're trying 
> to accomplish, since the solution seems so straightforward.
> 
> 
> Luck,
> 
> Sebastian  
> 
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "moztrader" <das300@xxxx> wrote:
> > 
> > I managed to solve this in a later post but for the record the 
> problem
> > is PARAMETER not being settable for an individual stock but all 
> stocks
> > . Therefore u can not individually set a buy price unless u use a 
> line
> > draw function .
> > 
> > MOZ
> > 
> > --- In amibroker@xxxxxxxxxxxxxxx, "sebastiandanconia"
> > <sebastiandanconia@xxxx> wrote:
> > > 
> > > I'm a pretty shallow thinker when it comes to coding and maybe 
> I'm 
> > > misunderstanding the problem, but VALUEWHEN wouldn't work 
> > > in "remembering" the entry price for other/later references?
> > > 
> > > 
> > > Luck,
> > > 
> > > Sebastian
> > > 
> > > --- In amibroker@xxxxxxxxxxxxxxx, "moztrader" <das300@xxxx> wrote:
> > > > 
> > > > OK,
> > > > Here is the CODE solution for the below problem to solve e) be 
> it
> > > > possibly a non elegant way it  works well ...
> > > > 
> > > > |||||||||||||||||||__bacround to 
> problem__|||||||||||||||||||||||
> > > > 
> > > > Initially a MS user I now have
> > > > a) converted all my MS formulas to AB -------------------->DONE
> > > > 
> > > > b) learned how to pull metastock data into AB - easy
> > > > bit-------------------------------------------------------->DONE
> > > > 
> > > > c) created PLOTS for tools-------------------------------->DONE
> > > > 
> > > > d) created Scans for BUYS -------------------------------->DONE
> > > > 
> > > > now I'm up to 
> > > > e) created SCANS to monitor for SELLS of ACTUAL TRADES still 
> live 
> > > > 
> > > > |||||||||||___The PROBLEM ____||||||||||||||||||||||
> > > > As I my TRADE SYSTEM have continual entries the problem is 
> telling 
> > > AB
> > > > which trade entry to base the EXIT on so I can scan every day 
> for 
> > > EXIT
> > > > rather than look at every EQUITY position im in . AS an example 
> > > > initial stop is totally based on ENTRY day and LEVEL . If you 
> read 
> > > the
> > > > below end a post i sent earlier tells how trying to Identify 
> the 
> > > ENTRY
> > > > based on PARAM (say uset a date and purchase level ) seems 
> useless 
> > > as
> > > > every equity has that param level. I needed to find an 
> individualway
> > > > of labelling the ENTRY day and time. I have not had any 
> response 
> > > from
> > > > AB so I figured I would continue trying to fix it. I found it 
> > > using "
> > > > line STUDY "  If I drew a line with right extension , lock, 
> STUDY ID
> > > > "SU" I could tell AB exactly the day from which to PLOT EXITS ( 
> > > > mainly the highest of 
> > > > a) Init STOP
> > > > b) Prof Trailing STOp
> > > > c) Normal trade STOP ( similar to inverse chandaleir type ) 
> > > > 
> > > > Below is the code for this solution and the method I use to 
> keep 
> > > track
> > > > of ACTIVE trades- 
> > > > 
> > > > Trading Procedure - 
> > > > 
> > > > When I perform a trade I :
> > > > 
> > > > T1) get code below and create a worksheet (this is done only 
> > > once !) 
> > > > T2) place that equity in a TRADE BIN WATCHLIST
> > > > T3) draw a line on sheet with 
> > > >           T3.1 RIGHT extension checked
> > > >           T3.2 Study ID = SU
> > > >           T4.3 Trade date entered as first date and level bought
> > > > T4) U shuld see an exit plot now
> > > > T5) U can scan this watchlist for SELLS which = when Low breaks 
> the
> > > > EXIT plot .
> > > > 
> > > > :-) Hope this helps someone as it did me 
> > > > 
> > > > --------------------8<------8<---------------------------
> > > > 
> > > > 
> > > > Title = " zMF_HLV_AP_exitSTOP \n RED=INITstop,yellow 
> > > =trailSTOP,gren=
> > > > LLV" ;
> > > > 
> > > > //Instructions ----
> > > > // drawline starting from trade date and 
> > > > // level entered onto workspace , tick right extension AND 
> label 
> > > it "SU" 
> > > > // if inserting onto a blank workspace add chart ID you want the
> > > > Function to look at by looking up param function.
> > > > 
> > > > 
> > > > //||||||||||||||||||||||||||||||||||||||||||____Draw
> > > > 
> > > 
> OHCL___|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
> > > ||||||||||||
> > > > SetChartOptions(0,chartShowArrows);
> > > > mm = IIf(C > Ref(C,-1) , colorGreen,colorRed) ;
> > > > Plot( C, "Close", mm, styleNoTitle | ParamStyle("Style", 
> styleBar,
> > > > maskPrice ) );
> > > > 
> > > > 
> > > > // CALC STOP PARAMS
> > > > 
> > > > 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%
> > > > CHID = Param( "CHART ID obtain from param menu", 0, 0, 2000, 
> 1 ) ;
> > > > //get ID do not need to use unless u reference a different LINE 
> page
> > > > LLVperd = Param( "LLVperd", 57, 0, 200, 1 ) ; //get LLV PERD
> > > > 
> > > > ///calc when to print LINE starting from date of trade
> > > > 
> > > > ID = IIf( CHID > 0 , CHID , GetChartID() )  ; //finds CHART ID
> > > > Line = Study( "su" ,id ) ; // locates line
> > > > Lineval = IsEmpty( Line ) ; // when line is valid
> > > > 
> > > > //|||||||||||||||||||||____calc LINES
> > > > ____|||||||||||||||||||||||||||||||||||||||||||||||||||||
> > > > 
> > > > Hipoint = IIf( lineval == 0 ,  HighestSince( Lineval, H , 
> > > 1) ,Null ) ;
> > > >    // calc highest point since trade date
> > > > TRAILSTOP = Hipoint * ( 100 - TRstop )/100 ; // calc 33% 
> TRAILING
> > > > Profit STOP
> > > > INITSTOP = Line * ( 100 - instop )/100 ; // calc 20% INTI_STOP
> > > > LLVline = IIf( lineval ==0 ,  LLV( L,LLVperd) ,Null)  ;
> > > > 
> > > > //|||||||||||||||||||||____determine highest EXIT line or level 
> and
> > > > COLOR  ____|||||||||||||||||||||||||||
> > > > 
> > > > Hiline  =  IIf( initstop > LLVline , initstop , LLVline )  ;
> > > > Hiline1 = IIf( TRAILstop > HiLINE , TrailSTOP , Hiline ) ;
> > > > 
> > > > Hilinecol  =  IIf( initstop > LLVline , colorRed , 
> colorGreen )  ;
> > > > Hiline1col = IIf( TRAILstop > HiLINE , colorYellow , 
> Hilinecol ) ;
> > > > 
> > > 
> > //||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
> > > 
> ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
> > > |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
> > > > // SCAN to track EXITs
> > > > 
> > > > Buy =0 ;
> > > > Sell = L < Ref( HiLine1 , -1 )  ;
> > > > 
> > > 
> > //||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
> > > 
> ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
> > > |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
> > > > 
> > > > "ID = " + WriteVal(ID,1.2) ;
> > > > AddColumn(Sell, "sell",1.2) ;
> > > > 
> > > 
> > //||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
> > > 
> ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
> > > |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
> > > > // PLOT
> > > > 
> > > > Plot( Hiline1,"HILINE1",HiLINE1col,styleDashed ) ;
> > > > 
> > > > --------------------8<------8<---------------------------
> > > > 
> > > > 
> > > > --- In amibroker@xxxxxxxxxxxxxxx, "moztrader" <das300@xxxx> 
> wrote:
> > > > > 
> > > > > 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/