MultiCharts' PowerLanguage is "99% compatible" with TradeStation's EasyLanguage, and the systems that we will present in here should work fine on both platforms. We'll keep any trading systems that work only with PowerLanguage or EasyLanguage in other places.
As always, the first automated trading strategy we will present is based on "random" entries with fixed take profit and stop loss exits:
Note that for a variety of reasons, this version is not "really random". The entry is based on the direction of the last one minute bar rather than the output of a pseudo-random number generator. The TradeStation platform was originally conceived to work with "bars" rather than "ticks", and that legacy is still apparent in the current incarnation of EasyLanguage and hence PowerLanguage also. For an insight into the trials and tribulations of getting a TradeStation derivative working smoothly with ticks take a look at our initial experiences with FXCM Strategy Trader, which is itself a version of MultiCharts modified to use C# as its programming language instead of PowerLanguage.
Note too that this version of our trusty "as simple a trading strategy as it is possible to produce" is the shortest so far. The comments take up almost as much space as the code! The code is however slightly longer than you might at first expect. One quirk of EasyLanguage is that your stop and target need to be "refreshed" on every new bar, otherwise you will inadvertently discover that your first trade will never exit, if it doesn't do so on the first bar. Another quirk is that these stops and targets are defined in terms of money rather than pips, so some extra calculations need to be performed to do the conversion. It is also important to remember that if you implement your stops this way, they are ultimately implemented as market orders by the platform, and they are NOT sent to your broker until they have been triggered. Whether you consider this to be a pro or a con depends on whether you are more paranoid about your broker "running stops" or about your internet connection going down.
Note finally that the "Lots" input setting is currently set to 25,000, which is the minimum size for trading spot forex via IDEALPRO at Interactive Brokers. If you're using GuruEx01 to experiment with FX at LMAX, you might wish to change the default to 1! The same applies if you're experimenting with futures at Interactive Brokers, or any of the other brokers supported by MultiCharts for that matter.