Example strategy code

Author: SQ team

January 16th, 2019

Rating:
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

Example strategy code

Below if an example pseudo code of a strategy generated by StrategyQuant. You can see that strategy consists of entry orders, exit orders and trade management commands – such as trailing stop movements, etc.
Every strategy generated by the program can be viewed in this pseudo code or exported in the form of MetaTrader Expert Advisor (EA), NinjaTrader NinjaScript C# strategy or EasyLanguage for Tradestation/Multicharts.

 

 

====================================================================
== Entry conditions
==================================================================== 
LongEntryCondition = (Stoch(40, 1, 3) < 50)
ShortEntryCondition = (Stoch(40, 1, 3) > 50)

====================================================================
== Entry orders
====================================================================
-- Long entry
if LongEntryCondition is true {
   if No position is open then Buy at Ichimoku(6, 18, 38, Kijun-sen) + (0.4 * ATR(86)) Limit;
   Stop/Limit order expires after 34 bars.

   Stop Loss = 190 pips;
   Profit Target = (0.74 * ATR(87)) pips;

   // Move SL to BE (on close)
   Move Stop Loss to Entry price when in profit at least (77 * ATR(12)) pips;

   // Profit trailing (on close)
   Profit Trailing by 222 pips;

   // Stop trailing (on close)
   Move Stop to (Close(1) + (0.5) * BBWidthRatio(20, 2.0))) on bar close;
}

-- Short entry
if ShortEntryCondition is true {
   if No position is open then Sell at Ichimoku(6, 18, 38, Kijun-sen) + (-0.4 * ATR(86)) Limit;
   Stop/Limit order expires after 34 bars.

   Stop Loss = 190 pips;
   Profit Target = (0.74 * ATR(87)) pips;
}

====================================================================
== Exit orders
====================================================================
-- Long exit
if MarketPosition is Long {
   if (Bars Since Entry >= 33) {
      Close position at market;
   }
}

 

Supported building blocks

StrategyQuant supports over 250 building blocks, including all the standard technical indicators like CCI, RSI, Stochastic, Momentum, etc.

It also supports all standard order types – Market, Stop, Limit and advanced exit methods like Trailing Stop or Move Stop Loss to Break Even.

The best thing about new SQ X is that it allows you to create your own building block, or develop your own indicator that can be used to extend the program.

We will be continually adding new technical indicators and other features to the program

If you have your favorite indicator you’d like to see in StrategyQuant, just let us know.

Leave a Reply

Please Login to comment