Support Board
Date/Time: Mon, 23 Dec 2024 00:37:38 +0000
Post From: ACSIL REPLAY PROBLEM
[2015-08-26 19:05:27] |
User668659 - Posts: 6 |
Hello! I've recently notice that a study i made with some moving averages signals doesn't work well in realtime/replay(Accurate trading system back test mode). If i disconnect the live data and apply the study it works without a problem. The study draw some lines above/under price based on two movavg positions and draw a triangle above/under the crossing point of another two movavg. After a replay or working in real time appear signals that doesn't exist. Maybe there is something i don't know that changes in ACSIL under a replay/real time. I left the screenshots before/after replay. Here is the code: #include "sierrachart.h" #include "scstudyfunctions.h" #define RED RGB(255,0,0) #define BLUE RGB(0,128,255) SCDLLName("MovSlope") SCSFExport scsf_MovSlope(SCStudyInterfaceRef sc){ SCSubgraphRef MovSlope1 = sc.Subgraph[0]; SCSubgraphRef MovSlope2 = sc.Subgraph[1]; SCSubgraphRef MovSlope3 = sc.Subgraph[2]; SCSubgraphRef MovSlope4 = sc.Subgraph[3]; SCSubgraphRef MovSlope5 = sc.Subgraph[4]; SCSubgraphRef MovSlope6 = sc.Subgraph[5]; SCSubgraphRef MovSlope7 = sc.Subgraph[6]; SCSubgraphRef MovSlope8 = sc.Subgraph[7]; if (sc.SetDefaults){ sc.GraphName = "MovSlope"; sc.StudyDescription = "MovSlope"; sc.AutoLoop = 1; sc.FreeDLL = 0; sc.GraphRegion = 0; MovSlope1.Name = "MV1"; MovSlope1.DrawStyle = DRAWSTYLE_HIDDEN; MovSlope1.LineStyle = LINESTYLE_SOLID; MovSlope1.LineWidth = 3; MovSlope1.DrawZeros = false; MovSlope2.Name = "MV2"; MovSlope2.DrawStyle = DRAWSTYLE_HIDDEN; MovSlope2.LineStyle = LINESTYLE_SOLID; MovSlope2.LineWidth = 3; MovSlope2.DrawZeros = false; MovSlope3.Name = "MV3"; MovSlope3.DrawStyle = DRAWSTYLE_LINE_SKIPZEROS; MovSlope3.LineStyle = LINESTYLE_SOLID; MovSlope3.LineWidth = 3; MovSlope3.DrawZeros = false; MovSlope4.Name = "MV4"; MovSlope4.DrawStyle = DRAWSTYLE_LINE_SKIPZEROS; MovSlope4.LineStyle = LINESTYLE_SOLID; MovSlope4.LineWidth = 3; MovSlope4.DrawZeros = false; MovSlope5.Name = "MV5"; MovSlope5.DrawStyle = DRAWSTYLE_TRIANGLEDOWN; MovSlope5.LineWidth = 3; MovSlope5.DrawZeros = false; MovSlope6.Name = "MV6"; MovSlope6.DrawStyle = DRAWSTYLE_TRIANGLEUP; MovSlope6.LineWidth = 3; MovSlope6.DrawZeros = false; MovSlope7.Name = "MV7"; MovSlope7.DrawStyle = DRAWSTYLE_HIDDEN; MovSlope7.LineStyle = LINESTYLE_SOLID; MovSlope7.LineWidth = 3; MovSlope7.DrawZeros = false; MovSlope8.Name = "MV8"; MovSlope8.DrawStyle = DRAWSTYLE_HIDDEN; MovSlope8.LineStyle = LINESTYLE_SOLID; MovSlope8.LineWidth = 3; MovSlope8.DrawZeros = false; sc.Input[1].Name = "Red"; sc.Input[1].SetColor(RED); sc.Input[2].Name = "Blue"; sc.Input[2].SetColor(BLUE); return; } SCFloatArrayRef Last = sc.Close; sc.SimpleMovAvg(Last, MovSlope1, sc.Index, 5); sc.SimpleMovAvg(Last, MovSlope2, sc.Index, 10); sc.SimpleMovAvg(Last, MovSlope7, sc.Index, 12); sc.SimpleMovAvg(Last, MovSlope8, sc.Index, 16); float mov1 = MovSlope1[sc.Index]; float mov2 = MovSlope2[sc.Index]; float mov7 = MovSlope7[sc.Index]; float mov8 = MovSlope8[sc.Index]; if (mov1 > mov2) { MovSlope3[sc.Index] = mov1 + 6.0f; MovSlope3.DataColor[sc.Index] = sc.Input[2].GetColor(); } else if (mov1 < mov2) { MovSlope4[sc.Index] = mov1 - 6.0f; MovSlope4.DataColor[sc.Index] = sc.Input[1].GetColor(); } if ((MovSlope7[sc.Index - 1] > MovSlope8[sc.Index - 1]) && (MovSlope7[sc.Index] < MovSlope8[sc.Index])){ MovSlope5[sc.Index] = mov1 + 8.5f; MovSlope5.DataColor[sc.Index] = sc.Input[1].GetColor(); } else if ((MovSlope7[sc.Index - 1] < MovSlope8[sc.Index - 1]) && (MovSlope7[sc.Index] > MovSlope8[sc.Index])){ MovSlope6[sc.Index] = mov1 - 8.5f; MovSlope6.DataColor[sc.Index] = sc.Input[2].GetColor(); } } |