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

[amibroker] Re: 'Simple!' dynamic applystop help please



PureBytes Links

Trading Reference Links

Applystop take a value the buy day and keep it ( the same value fixed 
on buyday) during all the trade duration.
so it can't work the wy you want.
either you write a loop...
or you apply a stoploss at 30 points and a trailingstop at 40 points.



<firehorse888uk@xxxx> wrote:
> Hi,
> 
> I'm backtesting forex.
> 
> On the day of the trade, I want the stop loss to be 30pts.
> On subsequent days, I want the stop loss to be 40pts.
> Edited relevant section of code follows:
> 
> StopLvl = 0.0030;
> 
> Buydate = ValueWhen(Buy,Day()); // Determine buy day
> 
> StopLvlWid = 0.0010;
> 
> StopLvl = IIf( Day()!=Buydate, StopLvl+StopLvlWid, StopLvl);
> 
> ApplyStop(stopTypeLoss, stopModePoint, StopLvl, True, True);
> 
> 
> Can anyone see why the above code doesn't work.
> I've tracked StopLvl and it changes correctly for the following day.
> I've set dynamic level to true so I don't understand why the trade
> stops out at 30pts rather than 40pts on subsequent days.
> 
> Thanks
> Alan




------------------------ Yahoo! Groups Sponsor --------------------~--> 
What would our lives be like without music, dance, and theater?
Donate or volunteer in the arts today at Network for Good!
http://us.click.yahoo.com/Tcy2bD/SOnJAA/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/