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

Re: [amibroker] Apply trailing stop after 18:00



PureBytes Links

Trading Reference Links

you cannot use applystop like this
try this, it might work

Sell = Cross( Signal( fa, sa, sig ), MACD( fa, sa ) )
 or cross( valuewhen( timecondition2, C-0.1 ), L );

-- 
Cheers
Graham
AB-Write >< Professional AFL Writing Service
Yes, I write AFL code to your requirements
http://www.aflwriting.com


On 09/05/07, iliagold1 <iliagold1@xxxxxxxxx> wrote:
> Hello all,
>
> I would like to add a trailing stop after the last order of the day
> of 10 cents, how would I put that in the formula?
>
> I tried something like this but it does not work, please help.
>
> tn2 = TimeNum();
> timecondition2 = tn2 >= 180001;
>
> if( LastValue( Buy AND timecondition2 ) )
>
> {
> ApplyStop( 2, 2, 1, 100, False, 1 );
> }
>
>
> ----------
>
> Bellow is the full formula:
>
> /* variable = optimize( "Description", default, min, max, step ) */
> fa = Optimize( "MACD Fast", 661, 1, 1000, 10 );
> sa = Optimize("MACD Slow", 221, 1, 400, 10 );
> sig = Optimize( "Signal average", 171, 1, 200, 10 );
>
> tn = TimeNum();
> timecondition = tn >= 140000 AND tn < 180000;
>
> tn2 = TimeNum();
> timecondition2 = tn2 >= 180001;
>
> Buy = Cross( MACD( fa, sa ) , Signal( fa, sa, sig ) );
> Sell = Cross( Signal( fa, sa, sig ), MACD( fa, sa ) );
>
> Short = Sell;
> Cover = Buy;
>
> Buy = Buy AND timecondition;
> Short = Short AND timecondition;
> //Sell = Sell OR NOT timecondition;
> //Cover = Cover OR NOT timecondition;
>
> if( LastValue( Buy AND timecondition2 ) )
>
> {
> ApplyStop( 2, 2, 1, 100, False, 1 );
> }
>
> PositionSize = MarginDeposit = 1;


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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

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/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> 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/