Topic: Custom Indicators Development
I'm working on a new infrastructure that will greatly facilitate the development of custom indicators.
The indicator project is available at GitHub: https://github.com/PopovMP/FSB_Pro_Indicators
Create and Test Forex Strategies
You are not logged in. Please login or register.
Forex Software → Developers Forum → Custom Indicators Development
I'm working on a new infrastructure that will greatly facilitate the development of custom indicators.
The indicator project is available at GitHub: https://github.com/PopovMP/FSB_Pro_Indicators
Here is an example with Triple Exponential Moving Average
Full source code: https://gist.github.com/PopovMP/d66e8ea26e6c862a1ca8
Nice Work
1 - are the hidden parts like numerical and list parameters editable !!!!!
2- if we need to minimize OR increase some actions '' they normally come in IndParam.ListParam[0].ItemList
Can we?
3 - when coding a custom indicator we will inherit the name of the class only without the remaining part of code ?
4- Do you will Add extra Classes i.e '' indexed functions and logics '' to the program core to be ready used in the custom indicators!!!
5- Do you will add a new type of indicators '' currently not exist'' like index type of indicators !!!
6- We need extra slots for list parameters as well as numerical parameters .
1 - are the hidden parts like numerical and list parameters editable !!!!!
Everything is editable. It simple has default values and you set only what you need to change.
2- if we need to minimize OR increase some actions '' they normally come in IndParam.ListParam[0].ItemList Can we?
Yes we can.
3 - when coding a custom indicator we will inherit the name of the class only without the remaining part of code ?
Exactly. The other code is working in the inherited class "MainChartSingleLineIndicator" in that example.
4- Do you will Add extra Classes i.e '' indexed functions and logics '' to the program core to be ready used in the custom indicators!!!
Yes of course. I'll add all the indicator types available to be ready to use.
5- Do you will add a new type of indicators '' currently not exist'' like index type of indicators !!!
We can add all indicators that are calculate on the price\time\volume.
This will be open source project and available for download. It will include a testing module for testing the indicators on various conditions.
This is the inherited class from the previous example MainChartSingleLineIndicator: https://gist.github.com/PopovMP/b2a8b1a17d4fa334218c
It sets all default parameters. However, we can override everything we want to change.
The purpose of the new classes is to have only the bare minimum in the custom code. Only customization and the actual calculation.
I realized that there are limited types of indicators. For example there are only 3 types of indicators plotted on the main chart:
1. Single line indicator: Moving Averages ...
2. Crossing lines indicator: MA crossover, Alligator,.....
3. Band indicators (non crossing lines), Envelops, Bollinger Bands,....
So we can create a base class for each indicator type containing all default parameters, logic rules and calculations.
Will the "old" standard still be supported? Or do I have to use new base classes only?
All current indicators will work without problems. You may decide whether to use the new classes or the full code for your future indicators.
No changes required for the current code.
Here one more example where I use the base class but add more params and override some default settings.
Adaptive Moving Average
I have a question
Can the following be optimized
Logical Group
Signal Shift
Signal Repeat
OR could there be a change to the program to allow those to be optimized?
Thanks
daveM
And a further question.......
Is there any possibility to have colour choice?
No further questions..... until I think of more.........
Can the following be optimized
Logical Group
Signal Shift
Signal Repeat
This is not related to the Custom Indicators.
Is there any possibility to have colour choice?
The indicator color is a parameter and it can be set in the indicator code. It is possible to make an option for the color. For example you can use one of the list items to set the colour.
I may add colour and line style options for all indicators available in future versions.
Here is another example of indicator requested several days ago.
Average High Low Band
The complete code:
//==============================================================
// Forex Strategy Builder
// Copyright © Miroslav Popov. All rights reserved.
//==============================================================
// THIS CODE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE.
//==============================================================
using System.Drawing;
using ForexStrategyBuilder.Infrastructure.Enums;
using ForexStrategyBuilder.Infrastructure.Interfaces;
namespace ForexStrategyBuilder.Indicators.Custom
{
public class AverageHighLowBand : MainChartBandsIndicator
{
public AverageHighLowBand()
{
IndicatorName = "Average High Low Band";
IndicatorVersion = "1.0";
IndicatorAuthor = "Miroslav Popov";
IndicatorDescription = "Plots two MA lines calculated on High and Low";
}
public override void Initialize(SlotTypes slotType)
{
base.Initialize(slotType);
IndParam.ListParam[2].Enabled = false; // Hides the default base price
}
public override void Calculate(IDataSet dataSet)
{
InitCalculation(dataSet);
UpperBand = MovingAverage(IndicatorPeriod, 0, IndicatorMaMethod, High);
LowerBand = MovingAverage(IndicatorPeriod, 0, IndicatorMaMethod, Low);
PostCalculation();
// Override the default colors
Component[0].ChartColor = Color.ForestGreen;
Component[1].ChartColor = Color.Tomato;
}
}
}
The project loads data file and symbol properties. It calculates an indicator with random parameters.
If there is an error it will crash and you'll be able to debug the code right in the VisualStudio or whatever development environment you are using (Mono, SharpDevelop...)
The indicator project is available at GitHub: https://github.com/PopovMP/FSB_Pro_Indicators
the new design of indicators will increase the speed of generator Right!!!
I don't think it will increase the speed, it still depends on actual indicator calculations.
If we replaced a full ( for loop ) with one function
Example :
1 - if we need to Calculate the no. of bars passed since the highest value
2- Nbars above specific level before buy
......etc
if we need to calculate them we need a for loop inside the custom indicator which can be replaced with a predefined function
Is that has no effect on speed !!!
I think what you are suggesting is actually counter-productive, meaning it will be more time-consuming, but it's only my opinion. Think about it - another function call, it takes more than plain calculation. You can't escape the calc part, if you could, that would save time and resource.
Adding Extra Logics Request :
1- Flat logic '' No change in the indicator , oscillator(directional, non directional'' , Band logics ''
It will be helpful in indicators shows flat move for more than two consecutive bars
2- Adding the flip flop '' the bar opens above MA after opening below after opening above ''
It can be used
1-to filter Some noise
2-also can be used in reversal Structures
3-Or as a failure Cross type 1
3- The Failed Cross Logic 2 '' the bar moves( high or low ) Above or below but close in the other side of MA ( the close and open in one side which is against the failure move''
It is the light version of No.2 logic and has the same uses
It would be great to be able to use 'Logical Operator' in the generator
Thinking about the Ahmed's "Flip Flop" - it must be "No Flip Flop"
And from here comes my idea for an option: "Negate logical rule" check box.
I'm not sure if it's practical at all.
For example with "MA rises".
"Negate logical rule" = on
"Signal shift" = 3
"Signal repeat" = 3
It will mean that the MA must be even for 3 consecutive bars before allowing a trade.
It would be great to be able to use 'Logical Operator' in the generator
I donot Know if Logical operators in the scoop of that project or No but i will add to your request two of mine
1 - Why two Different Logics A and B which suppose to be different strategies Share the Same position size Window , If i will add to A strategy i have to add To B strategy as well , if i will reduce i have to reduce in both , why is that because i consider the position sizing box is integrated closely to the open logic more than any slot and need to be unique with every unique open logic slot !!!!
2- It will be better to Reserve the "empty slot "As A or B .... and let the generator to fill it with whatever indicators It will gives us the maximum benefits from Logical Groups
Thinking about the Ahmed's "Flip Flop" - it must be "No Flip Flop"
And from here comes my idea for an option: "Negate logical rule" check box.
I'm not sure if it's practical at all.For example with "MA rises".
"Negate logical rule" = on
"Signal shift" = 3
"Signal repeat" = 3It will mean that the MA must be even for 3 consecutive bars before allowing a trade.
For me Signal shift and repeat is Like ambiguous bars and because its manually controlled so i didnot use it
But The reason i asked for The Logic 2 & 3 is to deal with the Trader traps which mainly happens at the turning points or reversals Some of them happens fast '' Logic 3 '' , Example for it using pinbar at MA failure point .
Also Logic 1 worth a look '' Stagnant line or no change logic ''
Actions Of Buy@ and Sell@ Converted to Functions To Be Used in Open Slot
Examples: Enter the market At Top price If the last Fractal up break Still holding
so Fractal break became an event to be inherited
Regarding to the way the indicator coded it affects the speed of generator speed
Some times the indicator coded and gives the right results but in a way that slow down the speed
So wee need a guidance and best practices how to avoid that with custom indicators
Example for that is Fractal dimension index FDI When i load the indicator and link the slot to be sure it still exist
then run the generator it moves so horribly slow
Forex Software → Developers Forum → Custom Indicators Development
Powered by PunBB, supported by Informer Technologies, Inc.