Error

 Previous Topic Next Topic
 Steviet #1 Posted : Wednesday, August 16, 2023 9:36:09 PM(UTC) Rank: NewbieGroups: Registered Users, Subscribers, Unverified UsersJoined: 1/23/2015(UTC)Posts: 5Was thanked: 4 time(s) in 4 post(s) Hi,I have the following formula as an indicator for ATR based trailing stop: Code:``````atrperiod:=Input("ATR period :",1,100,5); atrfactor:=Input("ATR multiplication :",1,10,4); loss:=atrfactor*ATR(atrperiod); Trail:=  If(C>PREV AND Ref(C,-1)>PREV, Max(PREV,C-loss), If(CPREV,C-loss,C+loss))); Trail`````` I've attached it to the price chart and it works really well. When I add that same formula into the exploration, it comes out with different prices:Code:`````` atrperiod:=5; atrfactor:=4; loss:=atrfactor*ATR(atrperiod); Trail:=  If(C>PREV AND Ref(C,-1)>PREV, Max(PREV,C-loss), If(CPREV,C-loss,C+loss))); ````Trail```` For example:On the ADH.AX chart it shows the stop as \$1.4341 whereas on the explorer it shows \$1.4928What's worse is that on the chart during a Long period, the stop only goes up (which is the way it is supposed to work), but day to day on the explorer results, the trailing stop goes up AND down during a Long period, which it's not meant to do.This is the same for any chart that I run it against. As it's the explorer values that I'm putting into my trading stops, they're different to the charts that I've based my trading method on.Any ideas on what I'm doing wrong?Thanks!Steve.Edited by user Wednesday, August 16, 2023 9:46:20 PM(UTC)  | Reason: Tidy up
 Wanna join the discussion?! Login to your Discussions forum accountor Register a new forum account.
 MS Support #2 Posted : Thursday, August 17, 2023 2:57:12 PM(UTC) Rank: Advanced MemberGroups: Moderators, Registered, Registered Users, SubscribersJoined: 10/8/2010(UTC)Posts: 1,953Thanks: 91 timesWas thanked: 155 time(s) in 150 post(s) Originally Posted by: Steviet Hi,I have the following formula as an indicator for ATR based trailing stop: Code:``````atrperiod:=Input("ATR period :",1,100,5); atrfactor:=Input("ATR multiplication :",1,10,4); loss:=atrfactor*ATR(atrperiod); Trail:=  If(C>PREV AND Ref(C,-1)>PREV, Max(PREV,C-loss), If(CPREV,C-loss,C+loss))); Trail`````` I've attached it to the price chart and it works really well. When I add that same formula into the exploration, it comes out with different prices:Code:`````` atrperiod:=5; atrfactor:=4; loss:=atrfactor*ATR(atrperiod); Trail:=  If(C>PREV AND Ref(C,-1)>PREV, Max(PREV,C-loss), If(CPREV,C-loss,C+loss))); ````Trail```` For example:On the ADH.AX chart it shows the stop as \$1.4341 whereas on the explorer it shows \$1.4928What's worse is that on the chart during a Long period, the stop only goes up (which is the way it is supposed to work), but day to day on the explorer results, the trailing stop goes up AND down during a Long period, which it's not meant to do.This is the same for any chart that I run it against. As it's the explorer values that I'm putting into my trading stops, they're different to the charts that I've based my trading method on.Any ideas on what I'm doing wrong?Thanks!Steve. Hello,The first thing to check when you find differences between the Explorer and a chart is the load records. While some formulas may not change based on the records loaded (i.e. simple moving averages), other formulas can be sensitive to these differences.The Explorer's "default" setting is to Load Minimum Records. A chart's Default records typically will bring in about 1250 Daily records. If you are running a more recent version of MetaStock, when you open the Power Console and go to the Explorer, you should have a Load Options setting where you can change from Load Minimum Records to Load X Records. I would try setting to this Load 1250 and see if this provides more consistent results.Load Minimum Records is beneficial for speed purposes (especially with Online Data) but in some cases it will be best to have the load records match the data loaded into a chart. Load Minimum Records looks at the formula and attempts to determine the minimum amount of data required to get a calculation. With certain formula functions (i.e. exponential calculations, PREV) this can be problematic as their values can change as you load more data. 1 user thanked MS Support for this useful post. mattmct5619 on 11/24/2023(UTC)
 Steviet #3 Posted : Monday, August 21, 2023 10:09:18 PM(UTC) Rank: NewbieGroups: Registered Users, Subscribers, Unverified UsersJoined: 1/23/2015(UTC)Posts: 5Was thanked: 4 time(s) in 4 post(s) Thanks, that makes sense. I'll check and let you know. 1 user thanked Steviet for this useful post. mattmct5619 on 11/24/2023(UTC)
 Steviet #4 Posted : Thursday, December 14, 2023 2:08:54 AM(UTC) Rank: NewbieGroups: Registered Users, Subscribers, Unverified UsersJoined: 1/23/2015(UTC)Posts: 5Was thanked: 4 time(s) in 4 post(s) Yes, that did the trick! thanks for the help (sorry for the late reply) 1 user thanked Steviet for this useful post. MS Support on 12/14/2023(UTC)
 Users browsing this topic
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.