MarkovAlgorithmLibrary "MarkovAlgorithm"
Markov algorithm is a string rewriting system that uses grammar-like rules to operate on strings of
symbols. Markov algorithms have been shown to be Turing-complete, which means that they are suitable as a
general model of computation and can represent any mathematical expression from its simple notation.
~ wikipedia
.
reference:
en.wikipedia.org
rosettacode.org
parse(rules, separator)
Parameters:
rules (string)
separator (string)
Returns: - `array _rules`: List of rules.
---
Usage:
- `parse("|0 -> 0|| 1 -> 0| 0 -> ")`
apply(expression, rules)
Aplies rules to a expression.
Parameters:
expression (string) : `string`: Text expression to be formated by the rules.
rules (rule ) : `string`: Rules to apply to expression on a string format to be parsed.
Returns: - `string _result`: Formated expression.
---
Usage:
- `apply("101", parse("|0 -> 0|| 1 -> 0| 0 -> "))`
apply(expression, rules)
Parameters:
expression (string)
rules (string)
Returns: - `string _result`: Formated expression.
---
Usage:
- `apply("101", parse("|0 -> 0|| 1 -> 0| 0 -> "))`
rule
String pair that represents `pattern -> replace`, each rule may be ordinary or terminating.
Fields:
pattern (series string) : Pattern to replace.
replacement (series string) : Replacement patterns.
termination (series bool) : Termination rule.
Algorithm
Hulk Grid Algorithm - The Quant ScienceGrid-based intraday algorithm that works 50% in trend following and 50% in swing trading. Orders are executed on a grid of 10 levels. The grid levels are dynamic and calculated on the difference between the previous day's open and close. The algorithm makes only long trades based on the following logic:
1. The daily close of the previous day is analyzed, the first condition is met if the previous day was bullish, closing higher than the 'opening.
2. Must pass 'x' number of bars before placing market orders.
3. The range, as the difference between close and open of the previous day must be greater than 'x'.
If these three conditions are met then the algorithm will proceed to place long orders. On a total of 10 grid levels, up to five trades are executed per day.
If the current close is above level 1 of the grid (previous day's close) then trend following trading will take place, working on the upper 5 levels. In this case each order is placed starting at level 1 and closed at each level above.
If the current close is below level 1 of the grid (previous day's open) then swing trading will be carried out, working on the lower 5 levels. In this case each order is placed starting at level 2 and closed at the upper level.
If at the time of order execution the price is above or below the stop loss and take profit levels, the algorithm will cancel the orders and prevent trading.
All orders are closed exclusively for two reasons:
1. If the stop loss or take profit level is confirmed.
2. If the daily session is ended.
UI Interface
You can adjust:
1. Backtesting period
2. 'x' number of bars before placing orders at the market (remember to always add 2 to the number you enter in the user interface if you enter 2 then execution will occur at the market opening after the fourth bar).
3. Intercepted price range between close and open of the previous day, avoiding trading on days when the range is too low.
4. Stop loss, level calculated from the 'last lower grid, if the market breaks this level the grid is destroyed and closes all open positions.
5. Take profit, the level calculated from the last upper grid, if the market breaks this level the grid is destroyed and closes all open positions.
The backtesting you see in the example was generated on:
BINANCE:BTCUSDT
Timeframe 15 min
Stop loss 2%
Take profit 2%
Minimum bars 3
Size grid range 500
This algorithm can be used only on intraday timeframe.
iMoku (Ichimoku Complete Tool) - The Quant Science iMoku™ is a professional all-in-one solution for the famous Ichimoku Kinko Hyo indicator.
The algorithm includes:
1. Backtesting spot
2. Visual tool
3. Auto-trading functions
With iMoku you can test four different strategies.
Strategy 1: Cross Tenkan Sen - Kijun Sen
A long position is opened with 100% of the invested capital ($1000) when "Tenkan Sen" crossover "Kijun Sen".
Closing the long position on the opposite condition.
There are 3 different strength signals for this strategy: weak, normal, strong.
Weak : the signal is weak when the condition is true and the price is above the 'Kumo'
Normal : the signal is normal when the condition is true and the price is within the 'Kumo'
Strong : the signal is strong when the condition is true and the price is below the 'Kumo'
Strategy 2: Cross Price - Kijun Sen
A long position is opened with 100% of the invested capital ($1000) when the price crossover the 'Kijun Sen'.
Closing the long position on the opposite condition.
There are 3 different strength signals for this strategy: weak, normal, strong.
Weak : the signal is weak when the condition is true and the price is above the 'Kumo'
Normal : the signal is normal when the condition is true and the price is inside the 'Kumo'
Strong : the signal is strong when the condition is true and the price is below the 'Kumo'
Strategy 3: Kumo Breakout
A long position is opened with 100% of the invested capital ($1000) when the price breakup the 'Kumo'.
Closing the long position with a percentage stop loss and take profit on the invested capital.
Strategy 4: Kumo Twist
A long position is opened with 100% of the invested capital ($1000) when the 'Kumo' goes from negative to positive (called "Twist").
Closing the long position on the opposite condition.
There are 2 different strength signals for this strategy: weak, and strong.
Weak : the signal is weak when the condition is true and the price is above the 'Kumo'
Strong : the signal is strong when the condition is true and the price is below the 'Kumo'
This script is compliant with algorithmic trading.
You can use this script with trading terminals such as 3Commas or CryptoHopper. Connecting this script is very easy.
1. Enter the user interface
2. Select and activate a strategy
3. Copy your bot's links into the dedicated fields
4. Create and activate alert
Disclaimer: algorithmic trading involves risk, the user should consider aspects such as slippage, liquidity and costs when evaluating an asset. The Quant Science is not responsible for any kind of damage resulting from use of this script. By using this script you take all the responsibilities and risks.
GRID SPOT TRADING ALGORITHM - GRID BOT TRADING STRATEGYGRID SPOT TRADING ALGORITHM : LONG ONLY STRATEGY OPEN SOURCE
This is a long only strategy for spot assets.
HOW IT WORKS
Grid trading is a trading strategy where an investor creates a so-called "price grid". The basic idea of the strategy is to repeatedly buy at the pre-specified price and then wait for the price to rise above that level and then sell the position (and vice versa with shorting or hedging).
FEATURES
Grids: This algorithm has a total of 10 grids.
Take profit: The trader can increase or decrease the distance between the grids from the User Interface panel, the distance between one grid and another represents the take profit.
Management: The algorithm buys 10% of the capital every time the price breaks down a grid and sells during a rise to the next higher grid. The initial capital is invested in 10 sizes which represent 10% of the capital per trade.
Stop Loss: The algorithm knows no stop loss as long as it is not activated from the User Interface panel. By activating the stop loss from the User Interface panel the algorithm will insert a close condition on all trades which will be calculated from the last lower grid.
Trades: Trades are opened only if the price is within the grid. If the market leaves the grid the algorithm will not buy new positions or sell new positions.
Optimal market conditions: The favorable market for this algorithm is the sideways market.
LIMITATIONS OF THE MODEL
The trader must take into account that this is a static model. It only works perfectly well if the market is in a sideways phase and incurs heavy losses if the market takes a downward trend. The model is unusable for an uptrend. The trader must therefore carefully analyze the market where he intends to use this strategy, making sure that the price is in a sideways phase.
USES
Indispensable research and backtesting tool for those using bots for their investments. The algorithm produces a backtesting of the strategy for past history. It is used by professional traders to understand if this strategy has been profitable on a market and what parameters to use for bots using this strategy (Kucoin, Binance etc.).
If you would like to develop your own algorithm with customized conditions based on a grid strategy, please contact us.
If you need help in using this tool, please contact us without hesitation.
Volume Variation Index IndicatorThis tool is a quantitative tip for analysts who study volumes or create volume based trading strategies.
Like all our projects, we start with a statistical logic to which we add coding logic.
This indicator can save a huge amount of time in calculating the variation of volume between sessions .
How it work
The indicator calculates the difference between the volume of the last closing bar and the volume of the previous closing bar. It shows the difference between the trading volumes.
The session in which the trading volume is up are represented in green.
Red session represent trading volume down.
We have added a third function.
Through the User Interface the trader can activate or deactivate the variation average.
The indicator is able to calculate the average of the volume changes by representing it with a blue line.
To activate the average, simply set it to ON in the User Interface.
By default, the indicator calculates the average of the last 10 periods, but you are free to set this parameter in the User Interface.
Data access
To access the data, simply move the cursor. When you move the cursor over the green bars, the increase data will be displayed in green. By hovering the cursor over the red bars you will see the decrease data in red. By hovering the cursor over the average will show you the average data in blue.
The data is displayed in the top left corner of the indicator dashboard.
If you found this indicator helpful, please like our script.
Volatility indicator based on ATR Hello,
I'm sharing to you a volatility indicator I've done in the last few weeks based on ATR. There is multiple functionalities on this indicator, the first one is an overlay displaying when an asset is in an "overvolatily zone"
(displayed with red cross) and when we are in an "undervolatily zone" (displayed with green cross). You can change the sensibility of the signals in the parameters if you wish to have more or less greedy signals
(it will only modify the overvolatility signals). By the way those signals are not working for week-ends because volatility works differently on week-ends and it's not a good idea to count week-ends in the calculations, so do not worry if you see no signals on weekends.
Second part of the indicator is something I called "Atr bands" it's an equivalent to the famous Bollinger-Bands but based on ATR. I haven't backtested them yet but they seems really interesting in low ut
(15 mins seems to be the best ut for those) and they seems pretty bad in high ut so they can maybe be useful for low ut scalping.
Last thing, there is a parameter allowing you to display bands on the week-ends so you can easily see where the indicator won't give signals.
I would be really happy if I could have some feedsback if you try the indicator :)
Have a wonderful day
DMI + HMA - No Risk ManagementDMI (Directional Movement Index) and HMA (Hull Moving Average)
The DMI and HMA make a great combination, The DMI will gauge the market direction, while the HMA will add confirmation to the trend strength.
What is the DMI?
The DMI is an indicator that was developed by J. Welles Wilder in 1978. The Indicator was designed to identify in which direction the price is moving. This is done by comparing previous highs and lows and drawing 2 lines.
1. A Positive movement line
2. A Negative movement line
A third line can be added, which would be known as the ADX line or Average Directional Index. This can also be used to gauge the strength in which direction the market is moving.
When the Positive movement line (DI+) is above the Negative movement line (DI-) there is more upward pressure. Ofcourse visa versa, when the DI- is above the DI+ that would indicate more downwards pressure.
Want to know more about HMA? Check out one of our other published scripts
What is this strategy doing?
We are first waiting for the DMI to cross in our favoured direction, after that, we wait for the HMA to signal the entry. Without both conditions being true, no trade will be made.
Long Entries
1. DI+ crosses above DI-
2. HMA line 1 is above HMA line 2
Short Entries
1. DI- Crosses above DI+
2. HMA line 1 is below HMA lilne 2
Its as simple as that.
Conclusion
While this strategy does have its downsides, that can be reduced by adding some risk manegment into the script. In general the trade profitability is above average, And the max drawdown is at a minimum.
The settings have been optimised to suite BTCUSDT PERP markets. Though with small adjustments it can be used on many assets!
Hull Crossover Strategy no TP or SLWhat is it?
A simple yet effective strategy ran on the 30m chart.
This is a basic idea that can be expanded on using different indicator to either add signals or filter out certain bad signals!
The strategy consists of 1 fast moving average and 1 slow moving average.
Both of these moving averages are the Hull Moving Average
What is the Hull Moving Average?
The Hull Moving Average ( HMA ) is a directional trend indicator.
It captures the current market conditions and uses recent price action to determine if conditions are bullish or bearish relative to historical data.
The Hull is different from traditional trend indicators like the EMA and the SMA .
It is designed to reduce the lag often associated with other MAs by providing a faster signal on a smoother visual plane.
How it works?
When the fast HMA crosses over the slow HMA , we initiate a long signal, and
when the fast HMA crosses under the slow HMA , we initiate a short signal.
Conclusion
The power of simplicity is what makes this such a great core to use to build onto making something even better!
The results were optimised to suit the most common market conditions seen today.
******** Not financial advice! ********
Ichimoku Cloud Strategy Long Only [Bitduke]Slightly modificated and optimized for Pine Script 4.0, Ichimoku Cloud Strategy which, suddenly, good suitable for the several crypto assets.
Details:
Enter position when conversion line crosses base line up, and close it when the opposite happens.
Additional condition for open / close the trade is lagging span, it should be higher than cloud to open position and below - to close it.
Backtesting:
Backtested on SOLUSDT ( FTX, Binance )
+150% for 2021 year, 8% dd
+191% for all time, 32% dd
Disadvantages:
- Small number of trades
- Need to vary parameters for different coins (not very robust)
Should be tested carefully for other coins / stock market. Different parameters could be needed or even algo modifications.
Strategy doesn't repaint.
TV Community AlgoTV Community Algo is a free TradingView script that I designed from the ground to benefit the traders of this community. It has plenty of features that you will enjoy, and I have included documentation for how to use this below!
Settings:
Basic:
Turn the Void Lines on or off
Turn the Dashboard on or off
Turn the Signal Bars on or off
Turn the Support & Resistance Lines on or off
Turn the EMA 8 and EMA 200 on or off
Turn the Buy & Sell Signals on or off
Turn the Fibonacci Retracement Tool on or off
Style:
Change the Dashboard's distance from the price action
Change the Dashboard's Color and Transparency
Change the Dashboard Text Color
Change the Fibonacci Deviation
Make the Fibonacci Retracement Tool reverse
Make the Fibonacci Lines extend left, right, both directions, or none
Turn Fibonacci Prices on or off
Turn Fibonacci Levels on or off and change between percent or value
Change Fibonacci Label Position from the left or the right
Usage:
This algo has many uses including but not limited to:
Finding entries and exits using the EMA 8 and EMA 200 crossovers
Using the Void Lines to identify bounces or reversals
Using the Signal Bars to identify trend and confirmation for entries and exits
Using the Dashboard information for confirmation and informational purposes
In the images below, I give a few examples of the many uses of the TV Community Algo!
VOID LINES
The Void Lines are very helpful when it comes to identifying reversals.
TV COMMUNITY ALGO DASHBOARD
The Dashboard is filled with useful information that all traders can benefit from!
SIGNAL BARS
The colored candles known as Signal Bars inform you of when the price action is above or below the midpoint of the Void Lines.
AUTO SUPPORT & RESISTANCE LINES
These lines help traders find accurate levels of support & resistance on all time frames, and the lines change color depending on if the price is above or below them.
EMA 8 AND 200
The EMA 8 and EMA 200 crossovers can be used as entry and exit signals.
BUY & SELL SIGNALS
The BUY & SELL signals can be used to find optimal entries and exits for trades on any time frame. Smaller time frames are best for scalping, while larger time frames are more suited for longer trades. When combined with the EMA lines and Dashboard information, these signals can produce incredibly profitable trades.
AUTO FIBONACCI RETRACEMENT TOOL
The Auto Fibonacci Retracement Tool allows you to plot perfect Fib Lines every time.
Conclusion:
I truly hope that the TV Community Algo benefits the TradingView community and that you all find some value in it. I worked very hard on this product and I would love to see it put to good use.
with love,
-Lemon 🍋
This work is licensed under a Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) creativecommons.org
LordPepe Stochastic SignalsThis is the Lord Pepe. Howdy. Basic buy/sell indicator to accumulate along a downtrend and release your stack during the uptrend and oversold levels of the stochastic. The buys should be used to stack, and sells indicate levels of profit taking, they do not signal a long term reversal, only < 25% of stack should be released on "OB" signals.
OB - overbought (sell)
OS - oversold (buy)
function: Array DownsamplingA low cost function to down sample a array.
specially useful for pattern recognition algorithms.
Parabolic SAR [with Algorithm and Alerts]Hello All,
In one of my projects I needed Parabolic SAR algorithm. I decided to write it in Pine and publish it. Then I added Alerts and Labels. here it is ;)
ENJOY!
GMS: RSI StrategyThis is just a basic RSI strategy that it easy to use and quite comprehensive so you can quickly test out an idea based on RSI.
- I made it comprehensive in that you can select long, short, or both.
- There is a simple moving average trend filter. You can filter for trades above, below, or don't include it at all.
- The exit is based on a simple moving average.
The source code should be open if you want to see it or modify it for your own project. I hope it helps!
Andre
Global Market Signals
Data structure ListThe script shows a workaround for list in pine-script via drawings.
There are few restrictions with them:
1. The size of the list cannot be more that amount of allowed drawings (about 40 by now)
2. Because the list shares the space of drawings throughout the whole script, using drawings with the list must be careful, with handly creating and removing of each drawing, because otherwise pine's garbage collector might break the list
3. Setters and Getters must be called on every bar, because of implementation of functions in pine there are inner serieses, which must be updated on every bar. So wherever you have a setter or getter in the code - it must be called on every bar. But if it's just an update, then you should pass 'false' as a param of the funtion.
And an example of using the list - reversing of the list. When the list have been created, it's filled on every bar and then gets reversed. Plots show result before and after reversing of the list.
There are also some pieces of commented code showing possible way of working with another funtions of the list.
Insertion sort and binary searchThe script shows a workaround for arrays in pine-script via drawings.
There are few restrictions with them:
1. The length of the array cannot be more that amount of allowed drawings (about 40 by now)
2. Because the "array" shares the space of drawings throughout the whole script, using drawings with the "array" must be careful, with handly creating and removing of each drawing, because otherwise pine's garbage collector might break the "array"
3. Getter and Setter must be called on every bar, because of implementation of functions in pine there are inner serieses, which must be updated on every bar. So wherever you have a setter or getter in the code - it must be called on every bar. But if it's just an update, then you should pass 'false' as a param of the funtion.
The script also shows an example of implementation of Insertion sort of the array in pine: when the array have been created, it's filled with pseudo-random numbers and sorted on every bar. There are plotting of the array's numbers before/after soring to show the sorting result.
There's also an example of implementation of binary search: after generation elements of the array, the first element is kept in local variable and after sorting of the array, the scripts is looking for new element's position via binary search and then plot that new index in an array (last plotted value with the green color)
Dual Thrust Trading Algorithm (ps4)This is an PS4 update to the popular Dual Thrust trading algorithm posted by me some time ago (). It has been commonly used in futures, Forex and equity markets. The idea of Dual Thrust is similar to a typical breakout system, however dual thrust uses the historical price to construct update the look back period - theoretically making it more stable in any given period.
See: www.quantconnect.com
BSTtrend (and a quick note on trading psychology)Hi again :)
Script #2 for tonight, more to come :)
This one is a Pine transcription of a FXCM/LUA script called BSTrend
I used it years ago to trade index on very low timeframes with it. I'm always looking for oscillators that are more reactive than the traditional MACD. And even more reactive than the MACD Zero Lag
This is a proof of concept that Pinescript is my favorite trading programming language vs MT4/LUA/PRT. I just find it easier and the Pinescript community is helping a lot
With the BSTrend you can win but also lose. I see a lot of scripts out there but there is not a better or worst indicator. The key is HOW to use it.
In other words the key is your PSYCHOLOGY, without a rock-solid psychology, you'll end up committing a mistake even with G. himself whispering "BUY NOW", "SELL NOW" to your ears. (wait..... Do you mean this is happening only to me ????)
However, indicators help immensely in reducing the psychology pressure that we have to endure ... sometimes for days..... But better not to overcharge with dozens of indicators per chart and have a tool to detect whenever there is a confluence/convergence of your favorite indicators :) #algorithm #builder
I'll publish an educational post about next week
Those are the exact words that my mentor traders told me 6 years ago when I started trading
PS
____________________________________________________________
Be sure to hit the thumbs up as it shows me that I'm not doing this for nothing and will motivate to deliver more quality content in the future.
- I'm an officially approved PineEditor/LUA/MT4 approved mentor on codementor. You can request a coaching with me if you want and I'll teach you how to build kick-ass indicators and strategies
Jump on a 1 to 1 coaching with me
- You can also hire for a custom dev of your indicator/strategy/bot/chrome extension/python
Dual Thrust Trading AlgorithmThe Dual Thrust trading algorithm is a famous strategy developed by Michael Chalek. It has been commonly used in futures, forex and equity markets. The idea of Dual Thrust is similar to a typical breakout system, however dual thrust uses the historical price to construct update the look back period - theoretically making it more stable in any given period.
Oscillating Market Case StudyThis is a little something I created to analyze the market. Ultimately, I wanted to create something that could encapsulate the entire market as best as possible. The idea was simple, use technical analysis to create cases that would indicate entry positions and exit positions for long positions initially. After completing that, I decided to add a few shorting cases.
A combination of 25-30 indicators were used to create this, and the indicators were modified with a filter to create a smoothed overlay.
So here's the breakdown:
- 10 total cases: 7 long, 3 short
- The 7 long cases are broken down into three categories; long term, medium term, short term
- Short Term: OC1, OC2, STB1, STB2
- Medium Term: STB1, STB2
- Long Term: LTB1
- Shorting Cases: SC1, SC2, SC3
- The cases are both plotted as text and entry orders; this can be toggled on and off through the format menu.
I suggest you use the format menu to get the most out of this script. The menu consists of toggles to turn of the plots and/or the entries. It's pretty self explanatory. Use it to keep the chart cleared and concise so you only visualise the cases that you need.
Personally, the cases that have worked the best for me are:
- Long Cases: OC1, OC2, STB2, LTB1
- Shorting Cases: SC2, SC3
I kept this description as short as possible, but please feel free to reach out if you have any questions.
Pretty much, use the cases and see if it works for you.
Can someone please help me create an alert for this strategyHave tried a few different methods but just constantly get errors in different lines of code......been trying for hours *sigh*. Any help would be so greatly appreciated
Long when rsi overbought,
close trade when rsi oversold and < Vstop
//@version=3
strategy("Vstop and RSI", overlay=true)
//RSI Section
length = input(2, "RSI Period")
overSold = input(30, "Oversold Level")
overBought = input(70, "Overbought Level")
price = close
vrsi = rsi (price, length)
//VSTOP Section
vlength = input(2, "Vstop Length")
mult = input(2, "Vstop Mult")
atr_ = atr(vlength)
max1=0.0
min1=0.0
is_uptrend_prev = false
stop=0.0
vstop_prev=0.0
vstop1=0.0
is_uptrend=false
is_trend_changed=false
max_ = 0.0
min_ = 0.0
vstop=0.0
max1 := max(nz(max_ ), close)
min1 := min(nz(min_ ), close)
is_uptrend_prev := nz(is_uptrend , true)
stop := is_uptrend_prev ? max1 - mult * atr_ : min1 + mult * atr_
vstop_prev := nz(vstop )
vstop1 := is_uptrend_prev ? max(vstop_prev, stop) : min(vstop_prev, stop)
is_uptrend := close - vstop1 >= 0
is_trend_changed := is_uptrend != is_uptrend_prev
max_ := is_trend_changed ? close : max1
min_ := is_trend_changed ? close : min1
vstop := is_trend_changed ? is_uptrend ? max_ - mult * atr_ : min_ + mult * atr_ : vstop1
plot(vstop, color = is_uptrend ? green : red, style=cross, linewidth=2)
if vrsi > overBought
strategy.entry("Buy", strategy.long, comment="Buy")
if vrsi < overSold and vstop > price
strategy.entry("Sell", strategy.short, comment="Sell")
Forex Master v4.0 (EUR/USD Mean-Reversion Algorithm)DESCRIPTION
Forex Master v4.0 is a mean-reversion algorithm currently optimized for trading the EUR/USD pair on the 5M chart interval. All indicator inputs use the period's closing price and all trades are executed at the open of the period following the period where the trade signal was generated.
There are 3 main components that make up Forex Master v4.0:
I. Trend Filter
The algorithm uses a version of the ADX indicator as a trend filter to trade only in certain time periods where price is more likely to be range-bound (i.e., mean-reverting). This indicator is composed of a Fast ADX and a Slow ADX, both using the same look-back period of 50. However, the Fast ADX is smoothed with a 6-period EMA and the Slow ADX is smoothed with a 12-period EMA. When the Fast ADX is above the Slow ADX, the algorithm does not trade because this indicates that price is likelier to trend, which is bad for a mean-reversion system. Conversely, when the Fast ADX is below the Slow ADX, price is likelier to be ranging so this is the only time when the algorithm is allowed to trade.
II. Bollinger Bands
When allowed to trade by the Trend Filter, the algorithm uses the Bollinger Bands indicator to enter long and short positions. The Bolliger Bands indicator has a look-back period of 20 and a standard deviation of 1.5 for both upper and lower bands. When price crosses over the lower band, a Long Signal is generated and a long position is entered. When price crosses under the upper band, a Short Signal is generated and a short position is entered.
III. Money Management
Rule 1 - Each trade will use a limit order for a fixed quantity of 50,000 contracts (0.50 lot). The only exception is Rule
Rule 2 - Order pyramiding is enabled and up to 10 consecutive orders of the same signal can be executed (for example: 14 consecutive Long Signals are generated over 8 hours and the algorithm sends in 10 different buy orders at various prices for a total of 350,000 contracts).
Rule 3 - Every order will include a bracket with both TP and SL set at 50 pips (note: the algorithm only closes the current open position and does not enter the opposite trade once a TP or SL has been hit).
Rule 4 - When a new opposite trade signal is generated, the algorithm sends in a larger order to close the current open position as well as open a new one (for example: 14 consecutive Long Signals are generated over 8 hours and the algorithm sends in 10 different buy orders at various prices for a total of 350,000 contracts. A Short Signal is generated shortly after the 14th Long Signal. The algorithm then sends in a sell order for 400,000 contracts to close the 350,000 contracts long position and open a new short position of 50,000 contracts).