For testing some strategy templates problem I made simple
RSI strategy template.
RSI is used for entry and for exit.
Both RSIs has randomly set Perid and Level.
So I expect parameters RSIPeriod1, RSIPeriod2, RSILevel1 and
RSILevel2.
But RSILevel1 and RSILevel2 are missing.
=======================================================
In pseudo code is:
//--------------------------------------------------------------------
// Strategy
Parameters
//--------------------------------------------------------------------
int MagicNumber = 11111;
double ATR = 0;
int RSIPeriod1 = RSILower1;
int RSIPeriod2 = RSIHigher1;
int ATRPeriod1 = 14;
int ExitAfterBars1 = 15;
double StopLossCoef1 = 3;
….
//--------------------------------------------------------------------
// Trading rule: Trading signals (On Bar Open)
//--------------------------------------------------------------------
LongEntrySignal = (RSI(Main chart,RSIPeriod1,
PRICE_CLOSE)[1] < RSILower1);
ShortEntrySignal = false;
LongExitSignal = (RSI(Main chart,RSIPeriod2, PRICE_CLOSE)[1]
> RSIHigher1);
ShortExitSignal = false;
=======================================================
RSILower1 and RSIHigher1 are block identificcation. Not
parameter.
Formula:
int RSIPeriod1 = RSILower1;
int RSIPeriod2 = RSIHigher1;
is bad.
Information in editor for entry signal is:
RSI( Random(RSILower1, 2:4:1)[1] < Random(RSILower1,
21:27:2)
but it should be:
RSI( Random(RSIPeriod1, 2:4:1)[1] < Random(RSILevel1,
21:27:2)
Exit signal has similar problem.
Status changed from New to Fixed
Attachment image-0.png added
Attachment image-1.png added
based on what I see you are using block "RSI is lower than Level".
The formula is RSI(period) < level, the period and level parameters are randomized.
Level is a constant in Source code. If you want to have it as variable go to Source code - > Parameter variables and switch on Parametrize Constants.
For better understanding see my screenshot.
Tamas
I don't understand.
Both conditionbloks (RSIHigher.java and RSILower.java) has annotation @Parameter for variable Level.
So Level is parameter.
In form Edit Block is Level shown as a parameter. It is OK.
So Level should be in strategy source code as a parameter.
If you want to have it in source code as configurable variable switch on the option from my last comment.
That's all :)
It should be taken another way.
Levels should be in strategy code as a constant. But should have individual and clear name.
But in pseudo code is only:
int LongRSILowerPeriod1 = RSILower1;
int LongRSIHigherPeriod1 = RSIHigher1;
But this is bad:
a) no one variable for Levels
b) RSILower1 and RSIHigher1 are names of blocks and has no type definition
c) name of block is right to use as a variable only in case if block contains only one value (parameter or variable)
RSI block contains more values
Attachment image-0.png added
You are right that it shows random identification as a value, this is intentional.
The goal of SQ is not in generating proper and perfect Pseudo source code for strategy templates with randomizable parts, only for final strategies.
Strategy templates are best viewed in AlgoWizard editor.
I see in source code – pseudo code, MT4, MT5, jForex. All contains formula like this (MT4):
extern int LongRSILowerPeriod1 = RSILower1;
extern int LongRSIHigherPeriod1 = RSIHigher1;
(EL has the same problem, but another formula)
Problems:
1) no one variable for Levels
2) RSILower1 and RSIHigher1 are names of blocks and has no type definition
3) name of block is right to use as a variable only in case if block contains only one value (parameter or variable)
RSI block contains more values