Support Board
Date/Time: Fri, 27 Dec 2024 02:39:19 +0000
[User Discussion] - Timeframe Overlay
View Count: 1615
[2016-02-16 19:55:52] |
crossiman - Posts: 29 |
There is a study inside the Kiwi's Stuff 2012 called "NMinBars". There you can highlight a higher timeframe High/Low in a lower timeframe chart. In the attached picture you can see what I mean (5 min.-Chart with the 60 min. High/Lows). My question is: Is it possible to add a blank between the different High/Low boxes so that there is a clear borderline between the old time box and the next one ? In my attachment it means that I want to have a blank (space) between the hours. Many thanks ! |
NMinBars.png / V - Attached On 2016-02-16 19:55:18 UTC - Size: 30.96 KB - 394 views |
[2016-02-17 03:39:33] |
nicktrader - Posts: 721 |
To see the higher TF I am using the Study/ Price Overlay but with the same problem. I solved it with setting a vertical grid based on 1 Hour. |
MultiRectangle.png / V - Attached On 2016-02-17 03:38:16 UTC - Size: 14.02 KB - 374 views |
[2016-02-17 07:58:21] |
Kiwi - Posts: 375 |
You could use one on top of the other (one is stairsteps maybe and the other is vertical boxes). Or here is code for some 2 TF on one TF variations that I use myself ... I don't recall the last time I used the third one which mixes some things up ... but try them and see what works for you. http://i.imgur.com/T75aS0Y.png /***********************************************************************/ SCSFExport scsf_TwoTFBars(SCStudyGraphRef sc) { if (sc.SetDefaults) { sc.GraphName = "Two TimeFrame Bars"; sc.StudyDescription = " "; sc.Subgraph[0].Name = "sH"; sc.Subgraph[1].Name = "sL"; sc.Subgraph[2].Name = "fH"; sc.Subgraph[3].Name = "fL"; sc.Subgraph[6].Name = "D"; sc.Subgraph[7].Name = "o1"; sc.Subgraph[8].Name = "o2"; sc.Subgraph[10].Name = "high"; sc.Subgraph[11].Name = "low"; sc.Subgraph[12].Name = "lowesthigh"; sc.Subgraph[13].Name = "highestlow"; sc.Input[1].Name = "slow multiplier"; sc.Input[2].Name = "fast multiplier"; sc.Input[1].SetFloat(15.0); sc.Input[2].SetFloat(5.0); sc.Input[3].Name = "ValueOffset"; sc.Input[4].Name = "Cosmetic Offset Down"; sc.Input[3].SetFloat(1.5); sc.Input[4].SetFloat(0.05); sc.DrawZeros = 0; sc.FreeDLL = 0; return; } if(sc.Subgraph[9][1] == sc.BaseDateTimeIn[sc.ArraySize-1].GetTime() && sc.UpdateStartIndex != 0 && sc.BaseDataIn[1][sc.ArraySize-1] < (sc.Subgraph[1][sc.ArraySize-1] - sc.Input[4].FloatValue) && sc.BaseDataIn[2][sc.ArraySize-1] > (sc.Subgraph[2][sc.ArraySize-1] + sc.Input[4].FloatValue) ) return; sc.Subgraph[9][1] = sc.BaseDateTimeIn[sc.ArraySize-1].GetTime(); int& updown = sc.GetPersistentInt(9); float& Color = sc.GetPersistentFloat(9); float& cosmetic_offset = sc.Input[4].FloatValue; unsigned int& UpColor = sc.Subgraph[0].PrimaryColor; unsigned int& DnColor = sc.Subgraph[1].PrimaryColor; unsigned int& sUpColor = sc.Subgraph[2].PrimaryColor; unsigned int& sDnColor = sc.Subgraph[3].PrimaryColor; int pos, i; int h0, m, m0; float& offset = sc.Input[3].FloatValue; float &timeh = sc.Input[1].FloatValue; float& High = sc.GetPersistentFloat(1); float& Low = sc.GetPersistentFloat(2); float& pHigh = sc.GetPersistentFloat(5); float& pLow = sc.GetPersistentFloat(6); float& highestlow = sc.GetPersistentFloat(3); float& lowesthigh = sc.GetPersistentFloat(4); int& startbar = sc.GetPersistentInt(1); int& bar = sc.GetPersistentInt(2); float& sHigh = sc.GetPersistentFloat(11); float& sLow = sc.GetPersistentFloat(12); float& times = sc.Input[2].FloatValue; float& tPerBar = sc.GetPersistentFloat(13); if (sc.UpdateStartIndex == 0) { highestlow = 0.0; lowesthigh = 999999.9; updown = 1; startbar = 0; tPerBar = sc.SecondsPerBar/60.0; } else startbar = min(bar-timeh, sc.ArraySize); for (pos = startbar ; pos < sc.ArraySize; pos++) { int p = pos - 1; High = sc.Subgraph[10][p]; Low = sc.Subgraph[11][p]; lowesthigh = sc.Subgraph[12][p]; highestlow = sc.Subgraph[13][p]; TIME_TO_HMS(sc.BaseDateTimeIn[pos].GetTime(),h0,m0,m); float time_now = float(h0*60.0 + m0); //sc.Subgraph[7][pos] = time_now; //sc.Subgraph[8][pos] = fmod(time_now, timeh); if( fmod(time_now, timeh) == 0 ) { bar = pos; pHigh = High; pLow = Low; High = 0; Low = 99999; for(i = 0; i < timeh/tPerBar && (pos+i)<sc.ArraySize; i++) { if(sc.BaseDataIn[1][pos+i] > High) High = sc.BaseDataIn[1][pos+i]; if(sc.BaseDataIn[2][pos+i] < Low) Low = sc.BaseDataIn[2][pos+i]; } if(updown == 1) {if(Low > highestlow) highestlow = Low;} else if(High < lowesthigh) lowesthigh = High; if(High > lowesthigh+offset && Low >= pLow) { updown = 1; highestlow = Low; lowesthigh = High; } else if(Low<highestlow-offset && High <= pHigh) { updown = -1; lowesthigh = High; highestlow = Low; } } sc.Subgraph[6][pos] = updown; //fmod(float(m0),5); if(updown == 1) { sc.Subgraph[0].DataColor[pos] = UpColor; sc.Subgraph[2].DataColor[pos] = sUpColor; } else if(updown == -1) { sc.Subgraph[0].DataColor[pos] = DnColor; sc.Subgraph[2].DataColor[pos] = sDnColor; } sc.Subgraph[0][pos] = High+cosmetic_offset; sc.Subgraph[1][pos] = Low-cosmetic_offset; if(timeh == times || times == 0) return; if(fmod(time_now, times) == 0) { sHigh = 0; sLow = 99999; for(i = 0; i < times/tPerBar && (pos+i)<sc.ArraySize; i++) { if(sc.BaseDataIn[1][pos+i] > sHigh) sHigh = sc.BaseDataIn[1][pos+i]; if(sc.BaseDataIn[2][pos+i] < sLow) sLow = sc.BaseDataIn[2][pos+i]; } } sc.Subgraph[2][pos] = sHigh+cosmetic_offset; sc.Subgraph[3][pos] = sLow-cosmetic_offset; sc.Subgraph[10][pos] = High; sc.Subgraph[11][pos] = Low; sc.Subgraph[12][pos] = lowesthigh; sc.Subgraph[13][pos] = highestlow; } } /***********************************************************************/ SCSFExport scsf_TwoTFBarsSecs(SCStudyGraphRef sc) { if (sc.SetDefaults) { sc.GraphName = "Two TimeFrame Bars using Seconds"; sc.StudyDescription = " "; sc.Subgraph[0].Name = "hH"; sc.Subgraph[1].Name = "hL"; sc.Subgraph[2].Name = "mH"; sc.Subgraph[3].Name = "mL"; sc.Subgraph[6].Name = "D"; sc.Subgraph[7].Name = "o1"; sc.Subgraph[8].Name = "o2"; sc.Subgraph[10].Name = "high"; sc.Subgraph[11].Name = "low"; sc.Subgraph[12].Name = "lowesthigh"; sc.Subgraph[13].Name = "highestlow"; sc.Input[1].Name = "secs for high tf"; sc.Input[2].Name = "secs for short tf"; sc.Input[1].SetFloat(900.0); sc.Input[2].SetFloat(300.0); sc.Input[3].Name = "ValueOffset"; sc.Input[4].Name = "Cosmetic Offset Down"; sc.Input[3].SetFloat(1.5); sc.Input[4].SetFloat(0.05); sc.DrawZeros = 0; sc.FreeDLL = 0; return; } if(sc.Subgraph[9][1] == sc.BaseDateTimeIn[sc.ArraySize-1].GetTime() && sc.UpdateStartIndex != 0 && sc.BaseDataIn[1][sc.ArraySize-1] < (sc.Subgraph[1][sc.ArraySize-1] - sc.Input[4].FloatValue) && sc.BaseDataIn[2][sc.ArraySize-1] > (sc.Subgraph[2][sc.ArraySize-1] + sc.Input[4].FloatValue)) return; sc.Subgraph[9][1] = sc.BaseDateTimeIn[sc.ArraySize-1].GetTime(); int& updown = sc.GetPersistentInt(9); float& Color = sc.GetPersistentFloat(9); float& cosmetic_offset = sc.Input[4].FloatValue; unsigned int& UpColor = sc.Subgraph[0].PrimaryColor; unsigned int& DnColor = sc.Subgraph[1].PrimaryColor; unsigned int& sUpColor = sc.Subgraph[2].PrimaryColor; unsigned int& sDnColor = sc.Subgraph[3].PrimaryColor; int pos, i; int h0, m0, s0; float& offset = sc.Input[3].FloatValue; float &timeh = sc.Input[1].FloatValue; float& High = sc.GetPersistentFloat(1); float& Low = sc.GetPersistentFloat(2); float& pHigh = sc.GetPersistentFloat(5); float& pLow = sc.GetPersistentFloat(6); float& highestlow = sc.GetPersistentFloat(3); float& lowesthigh = sc.GetPersistentFloat(4); int& startbar = sc.GetPersistentInt(1); int& bar = sc.GetPersistentInt(2); float& sHigh = sc.GetPersistentFloat(11); float& sLow = sc.GetPersistentFloat(12); float& times = sc.Input[2].FloatValue; float& tPerBar = sc.GetPersistentFloat(13); if (sc.UpdateStartIndex == 0) { highestlow = 0.0; lowesthigh = 999999.9; updown = 1; startbar = 0; tPerBar = sc.SecondsPerBar; } else startbar = min(bar, sc.ArraySize); for (pos = startbar ; pos < sc.ArraySize; pos++) { int p = pos - 1; High = sc.Subgraph[10][p]; Low = sc.Subgraph[11][p]; lowesthigh = sc.Subgraph[12][p]; highestlow = sc.Subgraph[13][p]; TIME_TO_HMS(sc.BaseDateTimeIn[pos].GetTime(),h0,m0,s0); float time_now = float(h0*3600.0 + m0*60.0 + s0); //sc.Subgraph[7][pos] = time_now; //sc.Subgraph[8][pos] = fmod(time_now, timeh); if( fmod(time_now, timeh) == 0 ) { bar = pos; pHigh = High; pLow = Low; High = 0; Low = 99999; for(i = 0; i < timeh/tPerBar && (pos+i)<sc.ArraySize; i++) { if(sc.BaseDataIn[1][pos+i] > High) High = sc.BaseDataIn[1][pos+i]; if(sc.BaseDataIn[2][pos+i] < Low) Low = sc.BaseDataIn[2][pos+i]; } if(updown == 1) {if(Low > highestlow) highestlow = Low;} else if(High < lowesthigh) lowesthigh = High; if(High > lowesthigh+offset && Low >= pLow) { updown = 1; highestlow = Low; lowesthigh = High; } else if(Low<highestlow-offset && High <= pHigh) { updown = -1; lowesthigh = High; highestlow = Low; } } sc.Subgraph[6][pos] = updown; //fmod(float(m0),5); if(updown == 1) { sc.Subgraph[0].DataColor[pos] = UpColor; sc.Subgraph[2].DataColor[pos] = sUpColor; } else if(updown == -1) { sc.Subgraph[0].DataColor[pos] = DnColor; sc.Subgraph[2].DataColor[pos] = sDnColor; } sc.Subgraph[0][pos] = High+cosmetic_offset; sc.Subgraph[1][pos] = Low-cosmetic_offset; if(timeh == times || times == 0) return; if(fmod(time_now, times) == 0) { sHigh = 0; sLow = 99999; for(i = 0; i < times/tPerBar && (pos+i)<sc.ArraySize; i++) { if(sc.BaseDataIn[1][pos+i] > sHigh) sHigh = sc.BaseDataIn[1][pos+i]; if(sc.BaseDataIn[2][pos+i] < sLow) sLow = sc.BaseDataIn[2][pos+i]; } } sc.Subgraph[2][pos] = sHigh+cosmetic_offset; sc.Subgraph[3][pos] = sLow-cosmetic_offset; sc.Subgraph[10][pos] = High; sc.Subgraph[11][pos] = Low; sc.Subgraph[12][pos] = lowesthigh; sc.Subgraph[13][pos] = highestlow; } } /***********************************************************************/ SCSFExport scsf_TwoTFBarsX(SCStudyGraphRef sc) { if (sc.SetDefaults) { sc.GraphName = "Two TimeFrame Bars"; sc.StudyDescription = " "; sc.Subgraph[0].Name = "hH"; sc.Subgraph[1].Name = "hL"; sc.Subgraph[2].Name = "mH"; sc.Subgraph[3].Name = "mL"; sc.Subgraph[6].Name = "D"; sc.Subgraph[7].Name = "o1"; sc.Subgraph[8].Name = "o2"; sc.Subgraph[10].Name = "high"; sc.Subgraph[11].Name = "low"; sc.Subgraph[12].Name = "lowesthigh"; sc.Subgraph[13].Name = "highestlow"; sc.Subgraph[20].Name = "vwsess"; sc.Subgraph[21].Name = " "; sc.Subgraph[22].Name = " "; sc.Subgraph[23].Name = "vwday"; sc.Subgraph[24].Name = " "; sc.Subgraph[25].Name = " "; sc.Input[1].Name = "high multiplier"; sc.Input[2].Name = "medium multiplier"; sc.Input[1].SetFloat(15.0); sc.Input[2].SetFloat(5.0); sc.Input[3].Name = "ValueOffset"; sc.Input[4].Name = "Cosmetic Offset Down"; sc.Input[3].SetFloat(1.5); sc.Input[4].SetFloat(0.05); sc.Input[8].Name="VWAP Chart"; sc.Input[8].SetChartNumber(1); sc.DrawZeros = 0; sc.FreeDLL = 0; return; } if(sc.Subgraph[9][1] == sc.BaseDateTimeIn[sc.ArraySize-1].GetTime() && sc.UpdateStartIndex != 0 && sc.BaseDataIn[1][sc.ArraySize-1] < (sc.Subgraph[1][sc.ArraySize-1] - sc.Input[4].FloatValue) && sc.BaseDataIn[2][sc.ArraySize-1] > (sc.Subgraph[2][sc.ArraySize-1] + sc.Input[4].FloatValue)) return; sc.Subgraph[9][1] = sc.BaseDateTimeIn[sc.ArraySize-1].GetTime(); int& updown = sc.GetPersistentInt(9); float& Color = sc.GetPersistentFloat(9); float& cosmetic_offset = sc.Input[4].FloatValue; unsigned int& UpColor = sc.Subgraph[0].PrimaryColor; unsigned int& DnColor = sc.Subgraph[1].PrimaryColor; unsigned int& sUpColor = sc.Subgraph[2].PrimaryColor; unsigned int& sDnColor = sc.Subgraph[3].PrimaryColor; int pos, i; int h0, m, m0; float& offset = sc.Input[3].FloatValue; float &timeh = sc.Input[1].FloatValue; float& High = sc.GetPersistentFloat(1); float& Low = sc.GetPersistentFloat(2); float& pHigh = sc.GetPersistentFloat(5); float& pLow = sc.GetPersistentFloat(6); float& highestlow = sc.GetPersistentFloat(3); float& lowesthigh = sc.GetPersistentFloat(4); int& startbar = sc.GetPersistentInt(1); int& bar = sc.GetPersistentInt(2); int& showvwap = sc.GetPersistentInt(3); float& sHigh = sc.GetPersistentFloat(11); float& sLow = sc.GetPersistentFloat(12); float& times = sc.Input[2].FloatValue; float& tPerBar = sc.GetPersistentFloat(13); int vwapchart = sc.Input[8].GetChartNumber(); int vwap = sc.Input[8].GetStudyID(); if (sc.UpdateStartIndex == 0) { highestlow = 0.0; lowesthigh = 999999.9; updown = 1; startbar = 0; tPerBar = sc.SecondsPerBar/60.0; if(showvwap == 3) showvwap = 0; else showvwap +=1; } else startbar = min(bar, sc.ArraySize); SCFloatArray v1, v1h, v1l, v2, v2h, v2l; int vwcht = sc.Input[8].GetChartNumber(); if(showvwap > 1) { sc.GetStudyArrayFromChart(vwcht, 1, 1, v1); sc.GetStudyArrayFromChart(vwcht, 1, 2, v1h); sc.GetStudyArrayFromChart(vwcht, 1, 3, v1l); sc.GetStudyArrayFromChart(vwcht, 2, 1, v2); sc.GetStudyArrayFromChart(vwcht, 2, 2, v2h); sc.GetStudyArrayFromChart(vwcht, 2, 3, v2l); } for (pos = startbar ; pos < sc.ArraySize; pos++) { sc.Subgraph[7][pos] = 0; sc.Subgraph[8][pos] = 0; if(showvwap != 0 && v1.GetArraySize() != 0 && ((pos == sc.ArraySize - 1) || (sc.BaseDateTimeIn[pos+1].GetDate() == sc.BaseDateTimeIn[pos].GetDate() && sc.BaseDateTimeIn[pos+1].GetTime() != sc.SessionStartTime()))) { sc.Subgraph[20][pos] = v1[pos]; sc.Subgraph[21][pos] = v1h[pos]; sc.Subgraph[22][pos] = v1l[pos]; sc.Subgraph[23][pos] = v2[pos]; sc.Subgraph[24][pos] = v2h[pos]; sc.Subgraph[25][pos] = v2l[pos]; } int p = pos - 1; High = sc.Subgraph[10][p]; Low = sc.Subgraph[11][p]; lowesthigh = sc.Subgraph[12][p]; highestlow = sc.Subgraph[13][p]; TIME_TO_HMS(sc.BaseDateTimeIn[pos].GetTime(),h0,m0,m); float time_now = float(h0*60.0 + m0); //sc.Subgraph[7][pos] = time_now; //sc.Subgraph[8][pos] = fmod(time_now, timeh); if( fmod(time_now, timeh) == 0 ) { bar = pos; pHigh = High; pLow = Low; High = 0; Low = 99999; for(i = 0; i < timeh/tPerBar && (pos+i)<sc.ArraySize; i++) { if(sc.BaseDataIn[1][pos+i] > High) High = sc.BaseDataIn[1][pos+i]; if(sc.BaseDataIn[2][pos+i] < Low) Low = sc.BaseDataIn[2][pos+i]; } if(updown == 1) {if(Low > highestlow) highestlow = Low;} else if(High < lowesthigh) lowesthigh = High; if(High > lowesthigh+offset && Low >= pLow) { updown = 1; highestlow = Low; lowesthigh = High; } else if(Low<highestlow-offset && High <= pHigh) { updown = -1; lowesthigh = High; highestlow = Low; } } sc.Subgraph[6][pos] = updown; //fmod(float(m0),5); if(updown == 1) { sc.Subgraph[0].DataColor[pos] = UpColor; sc.Subgraph[2].DataColor[pos] = sUpColor; } else if(updown == -1) { sc.Subgraph[0].DataColor[pos] = DnColor; sc.Subgraph[2].DataColor[pos] = sDnColor; } sc.Subgraph[0][pos] = High+cosmetic_offset; sc.Subgraph[1][pos] = Low-cosmetic_offset; if(timeh == times || times == 0) return; if(fmod(time_now, times) == 0) { sHigh = 0; sLow = 99999; for(i = 0; i < times/tPerBar && (pos+i)<sc.ArraySize; i++) { if(sc.BaseDataIn[1][pos+i] > sHigh) sHigh = sc.BaseDataIn[1][pos+i]; if(sc.BaseDataIn[2][pos+i] < sLow) sLow = sc.BaseDataIn[2][pos+i]; } } sc.Subgraph[2][pos] = sHigh+cosmetic_offset; sc.Subgraph[3][pos] = sLow-cosmetic_offset; sc.Subgraph[10][pos] = High; sc.Subgraph[11][pos] = Low; sc.Subgraph[12][pos] = lowesthigh; sc.Subgraph[13][pos] = highestlow; if(showvwap == 0 || showvwap == 3) { sc.Subgraph[0][pos] = sc.Subgraph[1][pos] = 0; sc.Subgraph[2][pos] = sc.Subgraph[3][pos] = 0; } } } |
[2016-02-17 07:59:40] |
Kiwi - Posts: 375 |
Theres some bar coloring logic in mine based on my definition of up and down movements ... if you just set colours to the same for up and down it disappears. Or remove the code.
|
[2016-02-17 08:04:29] |
Kiwi - Posts: 375 |
And heres what it looks like when you overlay one on top of the other with stair steps for outlines. Select colours and line styles to taste of course. http://i.imgur.com/J9zHKOS.png |
[2016-02-17 11:43:32] |
crossiman - Posts: 29 |
Kiwi, great to get the reply and details from you ! I am honest - I am not the real programmer here... Can you tell me what I have to do with the code ? Do I have to copy it somewhere and then do my own setup with it? MANY THANKS ! |
[2016-02-18 00:01:47] |
Kiwi - Posts: 375 |
Here's a compiled version plus the source in a compilable text file. Save kiwi16.dll in your SierraChart Data directory and then look for it using these instructions 2 on in How to Use and Advanced Custom Study at this url https://www.sierrachart.com/index.php?page=doc/doc_DLLUsage.html |
Private File kiwi16.cpp - Attached On 2016-02-17 23:58:10 UTC - Size: 15.33 KB - 581 views kxisi-0218-0959.png / V - Attached On 2016-02-18 00:01:37 UTC - Size: 162.98 KB - 389 views |
To post a message in this thread, you need to log in with your Sierra Chart account: