Sebastian Woźniczka:
It looks like the calculations are done in the "start" function, but you don't call that function at all from the OnTick function.
Also, "start" is a reserved keyword in MQL. Since you're using #property strict, this is no big deal, but it's not good practice.
BTW, this is a lot of repeating code:
SemafornewHandle0=iCustom(NULL,0,"Semafor + 123Triangles new",true, 12.0,34.0,234.0,15,15,15,500,0,true,0,false,true,0.113225,Orange,DodgerBlue,Red,2,1,0,false,false,0,5); SemafornewHandle1=iCustom(NULL,0,"Semafor + 123Triangles new",true, 12.0,34.0,234.0,15,15,15,500,0,true,0,false,true,0.113225,Orange,DodgerBlue,Red,2,1,0,false,false,1,5); SemafornewHandle2=iCustom(NULL,0,"Semafor + 123Triangles new",true, 12.0,34.0,234.0,15,15,15,500,0,true,0,false,true,0.113225,Orange,DodgerBlue,Red,2,1,0,false,false,2,5); SemafornewHandle3=iCustom(NULL,0,"Semafor + 123Triangles new",true, 12.0,34.0,234.0,15,15,15,500,0,true,0,false,true,0.113225,Orange,DodgerBlue,Red,2,1,0,false,false,3,5); SemafornewHandle4=iCustom(NULL,0,"Semafor + 123Triangles new",true, 12.0,34.0,234.0,15,15,15,500,0,true,0,false,true,0.113225,Orange,DodgerBlue,Red,2,1,0,false,false,4,5); SemafornewHandle5=iCustom(NULL,0,"Semafor + 123Triangles new",true, 12.0,34.0,234.0,15,15,15,500,0,true,0,false,true,0.113225,Orange,DodgerBlue,Red,2,1,0,false,false,5,5); Print("Semafor123TriangleNew = ", SemafornewHandle0," ",SemafornewHandle1," ",SemafornewHandle2," ",SemafornewHandle3," ",SemafornewHandle4," ",SemafornewHandle5," ",SemafornewHandle6," ",SemafornewHandle7); reversalAlertHandle0=iCustom(NULL,0,"ReversalAlert",36.0,60.0,156.0,"",false,false,false,false,true,true,0,1); reversalAlertHandle1=iCustom(NULL,0,"ReversalAlert",36.0,60.0,156.0,"",false,false,false,false,true,true,1,1); reversalAlertHandle2=iCustom(NULL,0,"ReversalAlert",36.0,60.0,156.0,"",false,false,false,false,true,true,2,1); reversalAlertHandle3=iCustom(NULL,0,"ReversalAlert",36.0,60.0,156.0,"",false,false,false,false,true,true,3,1); reversalAlertHandle4=iCustom(NULL,0,"ReversalAlert",36.0,60.0,156.0,"",false,false,false,false,true,true,4,1); reversalAlertHandle5=iCustom(NULL,0,"ReversalAlert",36.0,60.0,156.0,"",false,false,false,false,true,true,5,1); reversalAlertHandle6=iCustom(NULL,0,"ReversalAlert",36.0,60.0,156.0,"",false,false,false,false,true,true,6,1); reversalAlertHandle7=iCustom(NULL,0,"ReversalAlert",36.0,60.0,156.0,"",false,false,false,false,true,true,7,1); Print("ReversalAlert = ",reversalAlertHandle0," ",reversalAlertHandle1," ",reversalAlertHandle2," ",reversalAlertHandle3," ",reversalAlertHandle4,"",reversalAlertHandle5," ",reversalAlertHandle6,"",reversalAlertHandle7);
I'd create a function for each indicator that takes in the parameters that actually change and returns the values you're looking for. From there, create two arrays and then loop through X amount times, calling those functions and filling the arrays up with the values.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi guys!
I am trying to create a trading strategy, which follows a simple rule:
If Reversal Indicator prints some specific values and we have less than 10 open positions then we open a Sell position.
If Reversal Indicator prints these values but we have 10 open positions, then the strategy should close ALL active Sell positions.
Although no error appears, my code is not working. The strategy even stopped printing Reversal Alert's values, which is odd.
Could you please give me some advice on how to fix this? I guess it involves some error with brackets?
I would be extremly grateful for any help.