I am new to development with NT.
I am trying to create an indicator that draws four squares (one bellow each other) in a different panel.
Each square takes its color depending on condition based on different timeframes.
For example:
When in 1 minute graph:
If close of 5 minute graph>open 5 minute graph then draws a green square, else draws a red one.
Bellow that square it will have to draw another one based on the same logic but calculated on 15 minute graph for example.
I have made the timeframes input parameters so I can define wich timeframes will be used.
Then I add timeframes like this:
else if (State == State.Configure)
{
AddDataSeries(Data.BarsPeriodType.Minute, Period_1);
AddDataSeries(Data.BarsPeriodType.Minute, Period_2);
AddDataSeries(Data.BarsPeriodType.Minute, Period_3);
AddDataSeries(Data.BarsPeriodType.Minute, Period_4);
}
After that on the OnBarUpdate() do all calculations.
I am using a FOR sentence and a SWITCH / CASE like this:
for( tf=1; tf<=4; tf++)
{
switch(tf)
{
case 1:
if (Closes[tf][0] > Opens[tf][0])
{
Draw.Square(this, "Up Square"+CurrentBar, true, 0, 0+Gap*3, Brushes.Green);
}
else if (Closes[tf][0] < Opens[tf][0])
{
Draw.Square(this, "Down Square"+CurrentBar, true, 0, 0+Gap*3, Brushes.Red);
}
break;
//it continues for the 4 iterations because I have 4 timeseries
I am supposed to have 4 squares in a row on each bar but it's not plotting correctly
Also, I think it is using a lot of memory since pc performance decreases.
Can you help me giving me some lights on having this working properly??
Thanks
.
Comment