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

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



PureBytes Links

Trading Reference Links

Hello,

Your formula logic is flawed.

Day() represents DAY NUMBER (1-31) not date,
so
ValueWhen(Buy,Day())
will be true EVERY MONTH when day is the same as day of the entry
(previous month(s))


Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "firehorse888uk" <firehorse888uk@xxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Friday, May 27, 2005 7:50 PM
Subject: [amibroker] 'Simple!' dynamic applystop help please


> 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
> 
> 
> 
> 
> 
> 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 --------------------~--> 
Has someone you know been affected by illness or disease?
Network for Good is THE place to support health awareness efforts!
http://us.click.yahoo.com/Rcy2bD/UOnJAA/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/