Setting StopLosses and ProfitTargets without using actual dollar amounts
I'm trying to write a strategy for trading the ES emini futures contract (e.g., ESZ3), but am having trouble setting Stop Losses and Profit Targets.
Many posts I've seen on the web focus on setting Stops and Profits based on actual dollar amounts. For example, Stopping out if the trade goes $200 against me, and Taking Profit if the trade goes $800 in my favor. The typical SetStopLoss (200) and SetProfitTarget (800) would be used.
However, what if I want to set my Stop and Profit based on values of previous bars?
1. For example, what if I want to set my Stop at High (i.e., high of the previous bar)?
2. Also, what if I want to set my Target at Close - 8 points of the contract? (That is, I want my Target to be hit after price goes 8 points (or $400) below the close of the previous bar?
I can't seem to figure out how to set this using the SetStopLoss and SetProfitTarget functions.
I am completely new to EasyLanguage and programming in general. I am hoping someone could help me set a trailing stop loss which is not measured in $ but in %. In other words, I want to exit a long position if it falls by 1% from its highest point after entry, as opposed to it falling by 1$. Please note that it's different from 'SetPercentTrailing' as it allows you to specify a percentage stop loss only relative to a certain $ profit level. I have tried the following code to exit a long position but it doesn't work:
Also how would you do such a trailing stop loss to exit a short position?
I have managed to find an extremely powerful stop loss strategy that does offer a % trailing stop loss, including many other sophisticated features. It looks quite exciting! However, as a user of MultiCharts, I can't use this code as it's written for TradeStation, which seems to be using a more up-to-date version of EasyLanguage than MultiCharts. For example, when I compile it in MultiCharts the editor doesn't understand "Method void", "#region", etc. I have already found on Big Mike forum how to deal with the 'method void' problem (bigmiketrading.com/easylanguage-programming/14181-tradestation-9-easylanguage-multi-charts-easy-language.html), but my programming skill is so poor that I don't really understand the suggested solution.
Would there be anyone kindhearted enough to help me out here please
The description and the code for the stop loss strategy I found is here: hightick.com/Tradestation/Strategy/StopsFlexible/index.html