Lumios wrote: Sat Jun 27, 2020 12:59 pm
Banzai, this is such a great idea. Trying to learn and study this, is there a resource you can point me in the direction of?
Thanks to jeanlouie codes/templates, I was able to copy and paste.
That's why I always post the original indicator and the new button indicator so you can compare the codes.
I started out by comparing the codes of "Swing_ZZ.mq4" and "Swing_ZZ_w_toggle.mq4"
viewtopic.php?p=1295413353#p1295413353
---------------------------------------------------------------------------
The idea is when you click the
OFF button,
change all colors to clrNONE
Since there's no colors, we don't see anything on the chart. That's the trick.
Code: Select all
if(ObjectGetInteger(0,"Swing_ZZ_tog_btn",OBJPROP_STATE)){
ObjectSetString(0,"Swing_ZZ_tog_btn",OBJPROP_TEXT,btn_pressed);
SetIndexStyle(2,DRAW_ARROW,STYLE_SOLID,1,clrNONE);
SetIndexStyle(1,DRAW_ARROW,STYLE_SOLID,1,clrNONE);
SetIndexStyle(0,DRAW_SECTION,STYLE_SOLID,1,clrNONE);
---------------------------------------------------------------------------
when you click the
ON button,
change all colors back to the original colors.
---------------------------------------------------------------------------
jeanlouie code is easier to understand than xard777 code
xard777 code is at:
viewtopic.php?p=1295413346#p1295413346