Hello traders.
This is the full detailed description of my JAN24 automated strategy run during May 2024 contest period.
The strategy uses a single simple moving average indicator (SMA) and a 1-hour candle pattern, if the price is below the SMA at 2AM UTC the strategy waits for the latest H1 bear candle to close, then opens a GBPUSD buy position, or a sell position if otherwise (latest H1 bull candle to close if price is above the SMA).
The strategy is designed to open only one trade per day, take profit is set at 5 pips and stop loss at 250 pips, the SMA is set on default settings (period 30) using hourly candles.
The strategy always trades with the maximum volume possible as the equity increases, and the max slippage is 5 pips.
Here is the full description of the algorithm with a screenshot. (I could only upload one picture because the server gives me an error message if I tried to upload more)
On the screenshot above you see the use of "onCandle" as the start point of the flow since the strategy trades on candle close.
The blocks "1","2","3" are used to prevent the flow from executing on Sundays.
Bloc "A" gets the time unit to be used which is each hour and assigns the current time value to the parameter "TM".
Bloc "B" filters the GBPUSD instrument to be traded as default, and the bloc "C" filters the candles to be used to only get the hourly ones.
Bloc "D" is the SMA indicator used with default settings and its output value is assigned to the parameter "line15".
The flow then goes to bloc "E" that checks the value of the time parameter "TM".
Bloc "E" checks the current hour value "TM" against the preset parameter "TIME" which has a value of "2" (02:00 UTC).
If "TM" (the current time value) is less than "TIME", the flow continues to bloc "E1" that checks if the value of "TM" is equal to the preset parameter "TRADE_TRIGGER" which has a value of "1" (01:00 UTC).
(Blocs "E1,E2,E3" are used to enable the strategy to open a new trade for the following day)
If "TM" equals "TRADE_TRIGGER", bloc "E2" then checks the value of the parameter "TRADE" [which has a preset start value of "1"] if it is equal to "0", if so bloc "E3" re-assigns it with the value of "1".
You will understand later how the parameter "TRADE" is being used, as it is very important after the first ever trade is closed.
In bloc "E", if "TM" is greater or equal to "TIME" the flow continues to bloc "F" to check if a position is already open, if all positions amount is equal to "0" then the bloc "G" checks the value of "TRADE" if it is equal to "1" (which it is since its start preset value is "1").
Next is bloc "H" that gets the last closed candle data (named candle20).
Next above is bloc "I" that compares the last candle (candle20) close value to the SMA "line15" value.
If the candle close value is greater than "line15" value, bloc "J1" then checks if the last candle was a bull candle before allowing the strategy to market open a sell position.
If the candle close value is less than "line15" value, bloc "J2" then checks if the last candle was a bear candle before allowing the strategy to market open a buy position.
"K1" bloc is the market price sell order and "K2" bloc is the market price buy order, they use the settings mentioned at the begging of this article.
Then the last bloc "L" assigns the value of "0" to the parameter "TRADE" after either a buy or a sell position was open.
Assigning "0" to "TRADE" breaks the flow at bloc "G" to prevent the strategy from opening further positions until next day when condition "TM" equals "TRADE_TRIGGER" of bloc "E1" is met.
This is the full detailed description of my JAN24 automated strategy run during May 2024 contest period.
The strategy uses a single simple moving average indicator (SMA) and a 1-hour candle pattern, if the price is below the SMA at 2AM UTC the strategy waits for the latest H1 bear candle to close, then opens a GBPUSD buy position, or a sell position if otherwise (latest H1 bull candle to close if price is above the SMA).
The strategy is designed to open only one trade per day, take profit is set at 5 pips and stop loss at 250 pips, the SMA is set on default settings (period 30) using hourly candles.
The strategy always trades with the maximum volume possible as the equity increases, and the max slippage is 5 pips.
Here is the full description of the algorithm with a screenshot. (I could only upload one picture because the server gives me an error message if I tried to upload more)
On the screenshot above you see the use of "onCandle" as the start point of the flow since the strategy trades on candle close.
The blocks "1","2","3" are used to prevent the flow from executing on Sundays.
Bloc "A" gets the time unit to be used which is each hour and assigns the current time value to the parameter "TM".
Bloc "B" filters the GBPUSD instrument to be traded as default, and the bloc "C" filters the candles to be used to only get the hourly ones.
Bloc "D" is the SMA indicator used with default settings and its output value is assigned to the parameter "line15".
The flow then goes to bloc "E" that checks the value of the time parameter "TM".
Bloc "E" checks the current hour value "TM" against the preset parameter "TIME" which has a value of "2" (02:00 UTC).
If "TM" (the current time value) is less than "TIME", the flow continues to bloc "E1" that checks if the value of "TM" is equal to the preset parameter "TRADE_TRIGGER" which has a value of "1" (01:00 UTC).
(Blocs "E1,E2,E3" are used to enable the strategy to open a new trade for the following day)
If "TM" equals "TRADE_TRIGGER", bloc "E2" then checks the value of the parameter "TRADE" [which has a preset start value of "1"] if it is equal to "0", if so bloc "E3" re-assigns it with the value of "1".
You will understand later how the parameter "TRADE" is being used, as it is very important after the first ever trade is closed.
In bloc "E", if "TM" is greater or equal to "TIME" the flow continues to bloc "F" to check if a position is already open, if all positions amount is equal to "0" then the bloc "G" checks the value of "TRADE" if it is equal to "1" (which it is since its start preset value is "1").
Next is bloc "H" that gets the last closed candle data (named candle20).
Next above is bloc "I" that compares the last candle (candle20) close value to the SMA "line15" value.
If the candle close value is greater than "line15" value, bloc "J1" then checks if the last candle was a bull candle before allowing the strategy to market open a sell position.
If the candle close value is less than "line15" value, bloc "J2" then checks if the last candle was a bear candle before allowing the strategy to market open a buy position.
"K1" bloc is the market price sell order and "K2" bloc is the market price buy order, they use the settings mentioned at the begging of this article.
Then the last bloc "L" assigns the value of "0" to the parameter "TRADE" after either a buy or a sell position was open.
Assigning "0" to "TRADE" breaks the flow at bloc "G" to prevent the strategy from opening further positions until next day when condition "TM" equals "TRADE_TRIGGER" of bloc "E1" is met.