Support Board
Date/Time: Sun, 24 Nov 2024 15:20:08 +0000
[User Discussion] - Buttons for 2X or 1/2X time frame ?
View Count: 2518
[2013-04-04 13:01:44] |
marcovth - Posts: 61 |
Hello ... Would it be possible to add buttons to change the bar period to 2X and 1/2X the current time frame ? |
[2013-04-04 14:21:50] |
marcovth - Posts: 61 |
Anyway ... this seems to work, just add Button ACS TOOL 8 & 9 to your tool bar. #include "sierrachart.h" SCDLLName("ChangeTimeFrame") SCSFExport scsf_ChangeTimeFrame(SCStudyGraphRef sc){ if (sc.SetDefaults){ sc.GraphName = "ChangeTimeFrame"; sc.DrawZeros = 1; sc.FreeDLL = 1; sc.AutoLoop = 1; sc.GraphRegion = 0; sc.DrawZeros = 0; sc.ScaleRangeType = SCALE_INDEPENDENT; return; } int& MenuID8 = sc.PersistVars->i1; int& MenuID9 = sc.PersistVars->i2; if (sc.UpdateStartIndex == 0){ sc.SetACSToolToolTip(8,"2X"); sc.SetACSToolButtonText(8, "2X"); if (MenuID8 <= 0) MenuID8 = sc.AddACSChartShortcutMenuItem(sc.ChartNumber, "2X"); sc.SetACSToolToolTip(9,"hX"); sc.SetACSToolButtonText(9, "hX"); if (MenuID9 <= 0) MenuID9 = sc.AddACSChartShortcutMenuItem(sc.ChartNumber, "hX"); } // hX == half time frame if (sc.LastCallToFunction){ sc.RemoveACSChartShortcutMenuItem(sc.ChartNumber, MenuID8); sc.RemoveACSChartShortcutMenuItem(sc.ChartNumber, MenuID9); } if (sc.MenuEventID != 0){ if (sc.MenuEventID == SC_ACS_TOOL8){ if (sc.MouseEventType == SC_ACS_TOOL_ON){ if(sc.SecondsPerBar != 0) sc.SecondsPerBar=round(sc.SecondsPerBar*2); if(sc.DaysPerBar != 0) sc.DaysPerBar=round(sc.DaysPerBar*2); if(sc.DeltaVolumePerBar != 0) sc.DeltaVolumePerBar=round(sc.DeltaVolumePerBar*2); if(sc.TicksPerBar != 0) sc.TicksPerBar=round(sc.TicksPerBar*2); if(sc.VolumePerBar != 0) sc.VolumePerBar=round(sc.VolumePerBar*2); if(sc.RangeBarValue != 0) sc.RangeBarValue=round(sc.RangeBarValue*2); if(sc.RenkoTicksPerBar != 0) sc.RenkoTicksPerBar=round(sc.RenkoTicksPerBar*2); if(sc.ReversalTicksPerBar !=0) sc.ReversalTicksPerBar=round(sc.ReversalTicksPerBar*2); sc.SetACSToolEnable(SC_ACS_TOOL8, false); } } if (sc.MenuEventID == SC_ACS_TOOL9){ if (sc.MouseEventType == SC_ACS_TOOL_ON){ if(sc.SecondsPerBar != 0) sc.SecondsPerBar=round((float)sc.SecondsPerBar*0.5f); if(sc.DaysPerBar != 0) sc.DaysPerBar=round((float)sc.DaysPerBar*0.5f); if(sc.DeltaVolumePerBar != 0) sc.DeltaVolumePerBar=round((float)sc.DeltaVolumePerBar*0.5f); if(sc.TicksPerBar != 0) sc.TicksPerBar=round((float)sc.TicksPerBar*0.5f); if(sc.VolumePerBar != 0) sc.VolumePerBar=round((float)sc.VolumePerBar*0.5f); if(sc.RangeBarValue != 0) sc.RangeBarValue=round((float)sc.RangeBarValue*0.5f); if(sc.RenkoTicksPerBar != 0) sc.RenkoTicksPerBar=round((float)sc.RenkoTicksPerBar*0.5f); if(sc.ReversalTicksPerBar !=0) sc.ReversalTicksPerBar=round((float)sc.ReversalTicksPerBar*0.5f); sc.SetACSToolEnable(SC_ACS_TOOL9, false); } } } } |
To post a message in this thread, you need to log in with your Sierra Chart account: