Help with programming stop loss in Metastock

meanreversion

Senior member
Messages
3,398
Likes
537
Hi can anyone help me with this -- I have a set of defined entry rules in enhanced system tester, and once the trade has been entered, I would like the system to take profit or stop loss as a function of average true range.

At the moment, the only way I can see of setting stops and take profits is as either pips or percentage, but I'd like the distance to be variable and based on the ATR.

Tricky one, I know.. any help gladly received.
 
Hi can anyone help me with this -- I have a set of defined entry rules in enhanced system tester, and once the trade has been entered, I would like the system to take profit or stop loss as a function of average true range.

At the moment, the only way I can see of setting stops and take profits is as either pips or percentage, but I'd like the distance to be variable and based on the ATR.

Tricky one, I know.. any help gladly received.

Try coding your exit conditions under the Sell tab (assuming a Buy Long was taken initially) and leave everything blank under the Stops tab.
 
But if I do that, then my exit will be at the close of the bar won't it? I want to exit in real time..
 
In the formula section, I've used "C" to represent the close price.... is there another variable for real time price (if that's how it works)? I would need to use something like P-O, where P=current price and O=opening price..
 
In the formula section, I've used "C" to represent the close price.... is there another variable for real time price (if that's how it works)? I would need to use something like P-O, where P=current price and O=opening price..

Would something like the example below work (assuming an initial Buy Long)?

Initial Stop:= your code for the Initial Stop;
Profit Stop:= your code for the Profit Stop;

LOW<=(Initial Stop OR Profit Stop)
 
Last edited:
Would something like the example below work (assuming an initial Buy Long)?

Initial Stop:= your code for the Initial Stop;
Profit Stop:= your code for the Profit Stop;

LOW<=(Initial Stop OR Profit Stop)

Hi Meanreversion,

I have just re-visited your posts #3 & #4 and run a quick simulation on the EST to understand the points you were making.

My knowledge of the EST is very basic as I use TradeSim for back-testing purposes but it didn't take long to see the problem to which you refer. Perhaps using "Realistic Market Prices" would resolve the issue......but that was no help at all.

Obviously my suggested solution above is of no use what so ever!

Please accept my apologies for not running a simulation first to understand the problem before offering a solution.:eek:

rnr
 
Top