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

Re: Re: [amibroker] Plotshapes help



PureBytes Links

Trading Reference Links

Hello,

No, PlotShapes function uses regular scale of course.

"Ownscale" plots do not affect Y axis and as such can not be
synced with PlotShapes because they are using Y axis scale .

PlotShapes should be used together with regular scale plots
since they have to share same scaling.

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "Herman van den Bergen" <psytek@xxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Saturday, January 21, 2006 9:10 PM
Subject: RE: Re: [amibroker] Plotshapes help


> Tomasz,
>
> Adding a regular plot I am still am unable to place shapes a C-Price
> relative to the StylOwnScale plot - is it possible?
>
> HR = LastValue(Highest(ValueWhen(Status("barVisible"),High)));
> LR = LastValue(Lowest(ValueWhen(Status("barVisible"),Low)));
> Plot(C,"",1,1|styleNoLine|styleNoLabel);
> Plot(C,"",1,128|styleOwnScale,LR,HR);
> PlotShapes(shapeSmallCircle,colorWhite,0,C,0);
> Title =
> "Chart maximum: "+NumToStr(HR,1.2)+"\n"+
> "Chart minimum: "+NumToStr(LR,1.2);
>
>
> -----Original Message-----
> From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx]On Behalf
> Of Tomasz Janeczko
> Sent: Saturday, January 21, 2006 1:55 PM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: Re: Re: [amibroker] Plotshapes help
>
>
> Hello,
>
> At least one Plot statement must NOT use styleOwnScale.
> In other words at least one plot needs to use regular scale (Y axis needs to
> be setup by at least one plot),
> otherwise AB does not know how to calculate Y axis (because styleOwnScale
> means "DO NOT affect Y axis").
>
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message -----
> From: cstrader
> To: amibroker@xxxxxxxxxxxxxxx
> Sent: Saturday, January 21, 2006 4:43 PM
> Subject: Re: Re: [amibroker] Plotshapes help
>
>
> That code works OK for me, until I add a second styleownscale plot.  I'm
> guessing that there is some compromise scaling used in that case that we
> cannot access.   Maybe Tomasz will clue us in.
>
> ----- Original Message -----
> From: Herman van den Bergen
> To: amibroker@xxxxxxxxxxxxxxx
> Sent: Saturday, January 21, 2006 10:04 AM
> Subject: RE: Re: [amibroker] Plotshapes help
>
>
> This is what i had in mind... but it doesn't work. Don't know why
> not...perhaps someone can explain?
> HR = LastValue(Highest(ValueWhen(Status("barVisible"),High)));
> LR = LastValue(Lowest(ValueWhen(Status("barVisible"),Low)));
> Plot(C,"",1,128|styleOwnScale,LR,HR);
> PlotShapes(shapeSmallCircle,colorWhite,0,C,0);
> Title =
> "Chart maximum: "+NumToStr(HR,1.2)+"\n"+
> "Chart minimum: "+NumToStr(LR,1.2);
> H
> -----Original Message-----
> From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx]On Behalf
> Of cstrader
> Sent: Saturday, January 21, 2006 9:15 AM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [Norton AntiSpam] Re: [amibroker] Plotshapes help
>
>
> Hi Herman.
>
> Sorry, I'm missing that.  My 2nd indicator is on a completely different
> scale than the first.  Do I need to rescale the 2nd indicator back to the
> same scaling as the first?  I'm not sure how to do that.  Is it possible to
> get dynamically the high and low scalepoints from the automatic scaling?
>
> Thanks
>
> chuck
>
> ----- Original Message -----
> From: Herman van den Bergen
> To: amibroker@xxxxxxxxxxxxxxx
> Sent: Saturday, January 21, 2006 8:59 AM
> Subject: RE: [amibroker] Plotshapes help
>
>
> You can do this by defining the StyleOwnScale min and max and use the same
> scaling for other plots() or plotshapes().
>
> You may also be able to use styleLeftAxis...at least for one case.
>
> herman
> -----Original Message-----
> From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx]On Behalf
> Of cstrader
> Sent: Saturday, January 21, 2006 8:44 AM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [Norton AntiSpam] [amibroker] Plotshapes help
>
>
> Is it possible to use plotshapes to plot onto an indicator that is itself
> plotted using styleownscale?  From the manual it might seem so:
>
> yposition defines Y-position where shapes are plotted (by default they are
> plotted 'around' graph0 (first indicator) line)
>
> But I'm not sure if Y-position can ever incorporate the 2nd scaling.
>
> Thanks
>
>
>
> ----- Original Message -----
> From: james
> To: amibroker@xxxxxxxxxxxxxxx
> Sent: Saturday, January 21, 2006 12:10 AM
> Subject: Re: [amibroker] scaling out help
>
>
> Well I don't know, i am at a loss, think i will give up with it.
>
> The facts are:
>
> This is amibroker example code not mine as found in setpoitionsize help file
> the code operates normally with margin set to 100
> the only change in variable to create the problem is changing margin to <100
> is it not strange that cash is less than equity with 0 positions
>
> would be very interested if anyone out there can reproduce this
> problem......
>
>
> james.
>
>
>
>
>
> On 1/21/06, Terry <MagicTH@xxxxxxxxxxx> wrote:
> Having only used SigScaleIn twice (successfully) here's some thoughts that
> may b e off b ase:
>
> I'm wondering if your scale out conditions are continually true, thus
> continually scaling out?
>
> -or-
>
> Seems like here you are scaling out every time regardless of what happens in
> the loop. I'm also not sure you can set all your Buy conditions inside the
> loop without the scale out and do the scale out later without repeating the
> b uy.
>
>
> SetPositionSize( 50, spsPercentOfEquity );
> SetPositionSize( 50, spsPercentOfPosition * ( Buy == sigScaleOut ) );
>
> --
> Terry
> -----Original Message-----
> From: ami broker@xxxxxxxxxxxxxxx [mailto:ami b roker@xxxxxxxxxxxxxxx] On
> Behalf Of james
> Sent: Friday, January 20, 2006 16:59
> To: ami broker@xxxxxxxxxxxxxxx
>
> Sub ject: Re: [amib roker] scaling out help
>
> Thanks for the reply Terry, and for your ideas but i didn't explain myself
> fully....
>
> my problem pertains specifically to using scaling out with margin, in that
> my cash component quickly drops to
> zero despite zero positions and increasing equity and the backtester stops
> taking trades. It operates normally
> with margin set to 100.
>
> the following output from the detailed backtest shows my problem using only
> code supplied by amibroker (previous post) on ticker
> IBM. I just cant work out what i am doing wrong. On 28/8/2000 it exits a
> previously scaled out trade and you see zero
> positions and cash now much less than equity. this continues until cash goes
> to zero.
>
> any ideas anyone???
>
> 10/08/2000
>    Entry signals(score):
>    Exit signals:
>    1 Open Positions: , IBM (+89), Equity: 19874.5, Cash: 14317.9
> 11/08/2000
>    Entry signals(score):
>    Exit signals:IBM=Scale-Out,
>    Scale-Out Long IBM, Price 115.819, Shares 44, Fx Rate 1, Total Shares
> Hold 45, Exited 44, Avg. Price Entry 106.759 , Exit 115.819, Avg Fx. Rate
> Entry 1, Exit 1
>    1 Open Positions: , IBM (+45), Equity: 19912.2, Cash: 16865.8
> 14/08/2000
>    Entry signals(score):
>    Exit signals:
>    1 Open Positions: , IBM (+45), Equity: 20027, Cash: 16865.8
> 15/08/2000
>    Entry signals(score):
>    Exit signals:
>    1 Open Positions: , IBM (+45), Equity: 19972.5, Cash: 16865.8
> 16/08/2000
>    Entry signals(score):
>    Exit signals:
>    1 Open Positions: , IBM (+45), Equity: 19988.7, Cash: 16865.8
> 17/08/2000
>    Entry signals(score):
>    Exit signals:
>    1 Open Positions: , IBM (+45), Equity: 19994.1, Cash: 16865.8
> 18/08/2000
>    Entry signals(score):
>    Exit signals:
>    1 Open Positions: , IBM (+45), Equity: 19904.6, Cash: 16865.8
> 21/08/2000
>    Entry signals(score):
>    Exit signals:
>    1 Open Positions: , IBM (+45), Equity: 19948.2, Cash: 16865.8
> 22/08/2000
>    Entry signals(score):
>    Exit signals:
>    1 Open Positions: , IBM (+45), Equity: 19945.1, Cash: 16865.8
> 23/08/2000
>    Entry signals(score):
>    Exit signals:
>    1 Open Positions: , IBM (+45), Equity: 20027, Cash: 16865.8
> 24/08/2000
>    Entry signals(score):
>    Exit signals:
>    1 Open Positions: , IBM (+45), Equity: 20094.9, Cash: 16865.8
> 25/08/2000
>    Entry signals(score):
>    Exit signals:
>    1 Open Positions: , IBM (+45), Equity: 20277.2, Cash: 16865.8
> 28/08/2000
>    Entry signals(score):
>    Exit signals:IBM=Sell,
>    Exit Long, IBM, Price: 122.034, Shares: 45, Commission: 0.225, Profit:
> 959.944 (19.98 %), Entry rank:1, Equity: 20315.5 , Fx rate: 1
>    0 Open Positions: , Equity: 20427.5, Cash: 15331.7
> 29/08/2000
>    Entry signals(score):
>    Exit signals:
>    0 Open Positions: , Equity: 20427.5, Cash: 15331.7
> On 1/21/06, Terry < MagicTH@xxxxxxxxxxx> wrote:
> To use margin on via code you must also adjust positionSize according to
> your margin. Below I have included a file I use for most of my AFL's that
> does that and sets most other options as well. I discovered this by watching
> what the backtester did when Settings were used to adjust margin.
>
> The trick is in these lines of code:
>
> Margin = Param ( "Margin" ,100,10, 100,10 ) ; //Use this instead of my code
> below to vary margin in any amount
> leverage = 100/margin; //Will = 2 when margin = 50
> PositionSize = PositionSize * leverage;
>
>
> /*************************************** Settings for Operation
> ***************************************/
>
> when = ParamToggle ( "Trade Day:" , "Same Day|Next Day", 0);
> SetTradeDelays (when,when,when,when);
>
> OC = ParamField ( "Trade price" , field = 3 );
> BuyPrice = SellPrice = ShortPrice = CoverPrice = OC; //Ref(OC,when); Don't
> do this, Amib roker b acktest shifts the dates of the signals to the next
> day to pick up the right prices!
>
> //Print ab ove settings to Interpretation window:
> "Trade " + WriteIf (when, "Next Day " , "Same Day ") + WriteIf(BuyPrice == C
> ,"Close" ,WriteIf( BuyPrice == O,"Open" , "Other than Open or Close"));
>
> //Margin is set next based on user selection---> margin = 50 *
> ParamToggle("Margin","50,100",1) + 50; //False = 50 * 0 + 50 = 50 //True =
> 50 * 1 + 50 = 100
>
> //Set trading mode and commissions
>    _N (mode = ParamList ( "Trading Mode" , "Stocks 1:1,Margin 2:1,No
> Commission Funds 1:1,Futures xx:1", 0));
>    if (StrLeft (mode, 1 ) == "S" ) {fm = False; cm = 3 ; margin = 100 ;
> myCommission = .005;} //$0.005 per share IB
>    if (StrLeft (mode, 1 ) == "M" ) {fm = False; cm = 3 ; margin = 50 ;
> myCommission = .005;} //$0.005 per share IB
>    if (StrLeft (mode, 1 ) == "N" ) {fm = False; cm = 2 ; margin = 100 ;
> myCommission = 0 ;} //No commission ProFunds or Rydex
>    if (StrLeft (mode, 1 ) == "F" ) {fm = True;  cm = 3 ; margin = 100 ;
> myCommission = 2.4 ;} //$2.40 per contract each way
>    SetOption ("FuturesMode" ,fm); //Requires True or False. NOTE: This is
> insufficient. You must also check Futures mode in AA-Settings.
>    SetOption ("CommissionMode" , cm); /* Modes explained next...
>        0 - use portfolio manager commission tab le
>        1 - percent of trade
>        2 - $ per trade
>        3 - $ per share/contract    */
>    SetOption ("CommissionAmount" , myCommission); //Used to allow for
> slippage and commissions.
>
> SetOption ( "AllowSameBarExit" ,False);
> SetOption ( "ActivateStopsImmediately" ,False);
> SetOption ( "AllowPositionShrinking" ,True);
> SetOption ( "InitialEquity" , Param ( "Initial Equity" ,10000 , 10000 ,
> 1000000 , 5000));
> SetOption ( "InterestRate" ,0 );
> SetOption ( "MarginRequirement" ,margin);
> SetOption ( "MaxOpenPositions" , Param ( "Max Open Positions" ,1, 1 , 10 ,
> 1));
> SetOption ( "MinShares" ,1 );
> SetOption ( "NoDefaultColumns" ,False);
> SetOption ( "PriceBoundChecking" ,True);
> SetOption ( "ReverseSignalForcesExit" ,True); //Normally True if not trading
> Long and Short simultaneously
> SetOption ( "UsePrevBarEquityForPosSizing" ,False);
>
>
> PositionSize = Param ( "Position Size - see notes in SetOptions.afl" ,-
> 100,- 100 , 1000000, 1 );
> leverage = 100/margin; //defines leverage for stop loss and gain calcs b
> ased on selected margin.
> PositionSize = PositionSize * leverage;
> RoundLotSize = 1 ; //Overrides the Settings page. Set as desired.
>
> SetChartOptions (0, chartShowDates);
>
> //The following 4 lines for ApplyStop are here to prevent AA Settings from
> over-riding this code. Change as desired.
> ApplyStop ( stopTypeLoss,stopModeDisa ble , 100, 1, False,0 );
> ApplyStop ( stopTypeTrailing,stopModeDisa ble , 100, 1, False,0 );
> ApplyStop ( stopTypeNBar,stopModeDisa ble , 100, 1, False,0 );
> ApplyStop( stopTypeProfit,stopModeDisab le, 100, 1 ,False ,0 );
>
> /*********************************** END Settings for Operation
> ***************************************/
>
> --
> Terry
> -----Original Message-----
> From: amibroker@xxxxxxxxxxxxxxx [mailto: amibroker@xxxxxxxxxxxxxxx] On
> Behalf Of jimmyzee1975
> Sent: Thursday, January 19, 2006 21:06
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] scaling out help
>
> Hello, has anyone else managed to use scaling out successfully WITH
> margin??
>
> Not sure what i am doing wrong, just using example code (see below),
> backtest against eg IBM with margin at 50 and cant get it to work...
>
>
> Buy = Cross( MA( C, 10 ), MA( C, 50 ) );
> Sell = 0;
>
> // the system will exit
> // 50% of position if FIRST PROFIT TARGET stop is hit
> // 50% of position is SECOND PROFIT TARGET stop is hit
> // 100% of position if TRAILING STOP is hit
>
> FirstProfitTarget = 10; // profit
> SecondProfitTarget = 20; // in percent
> TrailingStop = 10; // also in percent
>
> priceatbuy=0;
> highsincebuy = 0;
>
> exit = 0;
>
> for( i = 0; i < BarCount; i++ )
> {
>   if( priceatbuy == 0 AND Buy[ i ] )
>    {
>       priceatbuy = BuyPrice[ i ];
>    }
>
>   if( priceatbuy > 0 )
>    {
>       highsincebuy = Max( High[ i ], highsincebuy );
>
>      if( exit == 0 AND
>          High[ i ] >= ( 1 + FirstProfitTarget * 0.01 ) * priceatbuy )
>       {
>         // first profit target hit - scale-out
>         exit = 1;
>         Buy[ i ] = sigScaleOut;
>       }
>
>      if( exit == 1 AND
>          High[ i ] >= ( 1 + SecondProfitTarget * 0.01 ) * priceatbuy )
>       {
>         // second profit target hit - exit
>         exit = 2;
>         SellPrice[ i ] = Max( Open[ i ], ( 1 + SecondProfitTarget *
> 0.01 ) * priceatbuy );
>       }
>
>      if( Low[ i ] <= ( 1 - TrailingStop * 0.01 ) * highsincebuy )
>       {
>         // trailing stop hit - exit
>         exit = 3;
>         SellPrice[ i ] = Min( Open[ i ], ( 1 - TrailingStop * 0.01 )
> * highsincebuy );
>       }
>
>      if( exit >= 2 )
>       {
>         Buy[ i ] = 0;
>         Sell[ i ] = exit + 1; // mark appropriate exit code
>         exit = 0;
>         priceatbuy = 0; // reset price
>         highsincebuy = 0;
>       }
>    }
> }
>
> SetPositionSize( 50, spsPercentOfEquity );
> SetPositionSize( 50, spsPercentOfPosition * ( Buy == sigScaleOut ) );
> // scale out 50% of position
>
>
>
>
>
>
>
> 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
>
>
>
>
>
>
>
> 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 Real estate investment software Investment
> property software
> Software support Real estate investment analysis software Investment
> software
>
>
>
>
>
> YAHOO! GROUPS LINKS
>
> §          Visit your group " amibroker" on the web.
>
> §          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 .
>
>
>
>
>
>
>
>
> 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 Real estate investment
> software Investment property software
> Software support Real estate investment analysis software Investment
> software
>
>
>
> YAHOO! GROUPS LINKS
>
> Visit your group "amibroker" on the web.
>
> 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 .
>
>
>
>
>
>
>
>
> 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
>
> Visit your group "amibroker" on the web.
>
> 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.
>
>
>
>
>
> 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! 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/