Error message appears when I activate a particular compiled study. There is data in the price chart that this study references.
I have no idea what this error message is trying to tell me. Can someone translate for me, so that I can try to fix the problem?
Study is missing Data -1. Please set up your chart data.
-
- Posts: 43
- Joined: 01 Dec 2008
- Has thanked: 2 times
- Been thanked: 2 times
-
- Posts: 742
- Joined: 09 Apr 2010
- Location: Texas
- Has thanked: 483 times
- Been thanked: 274 times
- Contact:
Re: Study is missing Data -1. Please set up your chart data.
If you post the study code, maybe we can spot the problem.
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Study is missing Data -1. Please set up your chart data.
RWDickinson, please specify the study you are using. If that is not a prebuilt study - please provide the code you are using. Please also attach the workspace you are using.
-
- Posts: 43
- Joined: 01 Dec 2008
- Has thanked: 2 times
- Been thanked: 2 times
Re: Study is missing Data -1. Please set up your chart data.
So I take it nobody is able to tell me what the error message means.
The study is my own code, and somewhat long. I'll copy it in full, since I have no way of determining in what portion the supposed error occurs (and since I can only attach one file).
---------------- code --------------------
{creates a set of arrows with accompanying text, top and bottom
of screen at right of last bar, for controlling Wilder-like parabolic
stops: one up, one down.
}
Inputs:
upAAccel(0.005),
upAllow(0.5),
dnAAccel(0.005),
dnAllow(0.5),
UpArrowVLoc(10),
DnArrowVLoc(90),
GoTextVLoc(50),
aMin(0.02),
aMax(0.20);
Variables:
Down (True), //convenience value for arrow direction
Up (False), //convenience value for arrow direction
Cen (2), //convenience value for horiz/vert center text
Rit(0), //convenience value for right align text
Lft (1), //convenience value for left align text
Blw (0), //convenience value for align text below
Abv (1), //convenience value for align text above
GoTextId (0), // go text recreated on each recalc
DnColor(0), // color of down arrow and plot
UpColor(0), // color of up arrow and plot
ReCalcPersist ArrowUpId (0), // up arrow stays where put within graph upon recalc
ReCalcPersist ArrowDnId (0), // dn arrow stays where put within graph upon recalc
vEnd(0);
if barNumber = 1 then begin
UpColor = GetPlotColor(101);
DnColor = GetPlotColor(102);
end; // bar 1
if LastBarOnChart_s then begin
// create and place controls if needed
if GoTextId = 0 then begin
// GoText gets (re)created on each recalc
GoTextId = Text_New_bn(BarNumber+2,RD_ScreenVPos(GoTextVLoc),"v^Go");
Text_SetStyle(GoTextId,Rit,Cen);
Text_SetColor(GoTextId,blue);
end;
if ArrowDnId = 0 then begin
// down arrow stays where put within graph
ArrowDnId = Arw_New_bn(BarNumber+2,RD_ScreenVPos(DnArrowVLoc),Down);
Arw_SetStyle(ArrowDnId,7); //chevron style
Arw_SetColor(ArrowDnId,DnColor);
end;
if ArrowUpId = 0 then begin
// up arrow stays where put within graph
ArrowUpId = Arw_New_bn(BarNumber+2,RD_ScreenVPos(UpArrowVLoc),Up);
Arw_SetStyle(ArrowUpId,7); //chevron style
Arw_SetColor(ArrowUpId,upColor);
end;
// 'Go' text should stay at rightmost bar +2
If Text_GetBarNumber(GoTextId) < BarNumber+2 then begin
// Text has drifted to left
Text_SetBarNumber(GoTextId,BarNumber+2);
end;
// up arrow should stay at rightmost bar +2 (if not within graph)
if Arw_GetBarNumber(ArrowUpId) > BarNumber
and Arw_GetBarNumber(ArrowUpId) <> BarNumber + 2
then begin
Arw_Delete(ArrowUpId);
ArrowUpId = Arw_new_bn(BarNumber+2,RD_ScreenVpos(UpArrowVLoc),Up);
Arw_SetStyle(ArrowUpId,7);
Arw_SetColor(ArrowUpId,upColor);
end;
// dn arrow should stay at rightmost bar +2 (if not within graph)
if Arw_GetBarNumber(ArrowDnId) > BarNumber
and Arw_GetBarNumber(ArrowDnId) <> BarNumber+2
then begin
Arw_delete(ArrowDnId);
ArrowDnId = Arw_New_bn(BarNumber+2,RD_ScreenVPos(DnArrowVLoc),Down);
Arw_SetStyle(ArrowDnId,7); //chevron style
Arw_SetColor(ArrowDnId,dnColor);
end;
// check whether the 'Go' text is selected
if MC_Text_GetActive = GoTextId and
(Arw_GetBarNumber(ArrowUpId) <= BarNumber
or Arw_GetBarNumber(ArrowDnId) <= BarNumber
)
then begin
// if so, delete the 'go' text and recalc
text_delete(GoTextId);
GoTextId = 0;
ReCalculate;
end;
end; {lastBarOnChart}
// do the plot
Variables:
uppstop_this (0),
uppstop_next (0),
dnpstop_this (0),
dnpstop_next (0),
IntraBarPersist plotted (False);
if barnumber = 1 then begin
cleardebug;
end;
if not plotted then begin
// plotting occurs at the first tick of each bar
uppstop_this = uppstop_next[1];
If uppstop_this <> 0 then begin
plot101(uppstop_this, "UpStop");
end else begin
noplot(101);
end;
dnpstop_this = dnpstop_next[1];
if dnpstop_this <> 0 then begin
plot102(dnpstop_this, "DnStop");
end else begin
noplot(102);
end;
plotted = True;
end; {plotted}
// calc new value(s) for pstop(s)
Variables:
upstrtd (-1), {-1 before, 0 during, +1 after the plot}
uphighest (0),
upMoveX(0),
upclosest(0),
upalpha (0),
dnstrtd (-1), {-1 before, 0 during, +1 after the plot}
dnlowest (0),
dnMoveX(0),
dnclosest(0),
dnalpha (0);
if barStatus = 2 then begin
// calc pstop_next at the end of every bar
plotted = False;
If upstrtd = -1 and
Arw_GetBarNumber(arrowUpId) = barNumber
then begin
{initial bar. calc beginning values}
upstrtd += 1;
uphighest = high;
upalpha = aMin;
uppstop_next = low-upAllow;
end else if upstrtd = 0 then begin
{calc next value in sequence}
if low <= uppstop_next[1] then begin
{we_ve hit the stop. end of indicator.}
upstrtd += 1;
uppstop_next = 0;
end else begin
{haven_t yet hit stop, direc is up}
upMoveX = uphighest - uppstop_next[1];
uppstop_next = uppstop_next[1] + upalpha*upMoveX;
upclosest = low;
if low[1] < low then upclosest = low[1];
if uppstop_next > upclosest then uppstop_next = upclosest;
if high > uphighest then begin
uphighest = high;
upalpha = upalpha + upaAccel;
if upalpha > aMax then upalpha = aMax;
end;
end; {low cmp pstop}
end;
if dnstrtd = -1 and
Arw_GetBarNumber(arrowDnId) = BarNumber
then begin
{calc beginning values}
upstrtd += 1;
uphighest = high;
upalpha = aMin;
dnpstop_next = high+dnAllow;
end else if dnstrtd = 0 then begin
{calc next value in sequence}
if high >= dnpstop_next[1] then begin
{we_ve hit the stop. end of indicator.}
dnstrtd += 1;
dnpstop_next = 0;
end else begin
{haven_t yet hit stop, direc is down}
dnMoveX = dnpstop_next[1] - dnlowest;
dnpstop_next = dnpstop_next[1] - dnalpha*dnMoveX;
dnclosest = high;
if high[1] > high then dnclosest = high[1];
if dnpstop_next < dnclosest then dnpstop_next = dnclosest;
if low < dnlowest then begin
dnlowest = low;
dnalpha = dnalpha + dnaAccel;
if dnalpha > aMax then dnalpha = aMax;
end;
end; {high cmp pstop}
end; {strtd status}
end; {barStatus}
The study is my own code, and somewhat long. I'll copy it in full, since I have no way of determining in what portion the supposed error occurs (and since I can only attach one file).
---------------- code --------------------
{creates a set of arrows with accompanying text, top and bottom
of screen at right of last bar, for controlling Wilder-like parabolic
stops: one up, one down.
}
Inputs:
upAAccel(0.005),
upAllow(0.5),
dnAAccel(0.005),
dnAllow(0.5),
UpArrowVLoc(10),
DnArrowVLoc(90),
GoTextVLoc(50),
aMin(0.02),
aMax(0.20);
Variables:
Down (True), //convenience value for arrow direction
Up (False), //convenience value for arrow direction
Cen (2), //convenience value for horiz/vert center text
Rit(0), //convenience value for right align text
Lft (1), //convenience value for left align text
Blw (0), //convenience value for align text below
Abv (1), //convenience value for align text above
GoTextId (0), // go text recreated on each recalc
DnColor(0), // color of down arrow and plot
UpColor(0), // color of up arrow and plot
ReCalcPersist ArrowUpId (0), // up arrow stays where put within graph upon recalc
ReCalcPersist ArrowDnId (0), // dn arrow stays where put within graph upon recalc
vEnd(0);
if barNumber = 1 then begin
UpColor = GetPlotColor(101);
DnColor = GetPlotColor(102);
end; // bar 1
if LastBarOnChart_s then begin
// create and place controls if needed
if GoTextId = 0 then begin
// GoText gets (re)created on each recalc
GoTextId = Text_New_bn(BarNumber+2,RD_ScreenVPos(GoTextVLoc),"v^Go");
Text_SetStyle(GoTextId,Rit,Cen);
Text_SetColor(GoTextId,blue);
end;
if ArrowDnId = 0 then begin
// down arrow stays where put within graph
ArrowDnId = Arw_New_bn(BarNumber+2,RD_ScreenVPos(DnArrowVLoc),Down);
Arw_SetStyle(ArrowDnId,7); //chevron style
Arw_SetColor(ArrowDnId,DnColor);
end;
if ArrowUpId = 0 then begin
// up arrow stays where put within graph
ArrowUpId = Arw_New_bn(BarNumber+2,RD_ScreenVPos(UpArrowVLoc),Up);
Arw_SetStyle(ArrowUpId,7); //chevron style
Arw_SetColor(ArrowUpId,upColor);
end;
// 'Go' text should stay at rightmost bar +2
If Text_GetBarNumber(GoTextId) < BarNumber+2 then begin
// Text has drifted to left
Text_SetBarNumber(GoTextId,BarNumber+2);
end;
// up arrow should stay at rightmost bar +2 (if not within graph)
if Arw_GetBarNumber(ArrowUpId) > BarNumber
and Arw_GetBarNumber(ArrowUpId) <> BarNumber + 2
then begin
Arw_Delete(ArrowUpId);
ArrowUpId = Arw_new_bn(BarNumber+2,RD_ScreenVpos(UpArrowVLoc),Up);
Arw_SetStyle(ArrowUpId,7);
Arw_SetColor(ArrowUpId,upColor);
end;
// dn arrow should stay at rightmost bar +2 (if not within graph)
if Arw_GetBarNumber(ArrowDnId) > BarNumber
and Arw_GetBarNumber(ArrowDnId) <> BarNumber+2
then begin
Arw_delete(ArrowDnId);
ArrowDnId = Arw_New_bn(BarNumber+2,RD_ScreenVPos(DnArrowVLoc),Down);
Arw_SetStyle(ArrowDnId,7); //chevron style
Arw_SetColor(ArrowDnId,dnColor);
end;
// check whether the 'Go' text is selected
if MC_Text_GetActive = GoTextId and
(Arw_GetBarNumber(ArrowUpId) <= BarNumber
or Arw_GetBarNumber(ArrowDnId) <= BarNumber
)
then begin
// if so, delete the 'go' text and recalc
text_delete(GoTextId);
GoTextId = 0;
ReCalculate;
end;
end; {lastBarOnChart}
// do the plot
Variables:
uppstop_this (0),
uppstop_next (0),
dnpstop_this (0),
dnpstop_next (0),
IntraBarPersist plotted (False);
if barnumber = 1 then begin
cleardebug;
end;
if not plotted then begin
// plotting occurs at the first tick of each bar
uppstop_this = uppstop_next[1];
If uppstop_this <> 0 then begin
plot101(uppstop_this, "UpStop");
end else begin
noplot(101);
end;
dnpstop_this = dnpstop_next[1];
if dnpstop_this <> 0 then begin
plot102(dnpstop_this, "DnStop");
end else begin
noplot(102);
end;
plotted = True;
end; {plotted}
// calc new value(s) for pstop(s)
Variables:
upstrtd (-1), {-1 before, 0 during, +1 after the plot}
uphighest (0),
upMoveX(0),
upclosest(0),
upalpha (0),
dnstrtd (-1), {-1 before, 0 during, +1 after the plot}
dnlowest (0),
dnMoveX(0),
dnclosest(0),
dnalpha (0);
if barStatus = 2 then begin
// calc pstop_next at the end of every bar
plotted = False;
If upstrtd = -1 and
Arw_GetBarNumber(arrowUpId) = barNumber
then begin
{initial bar. calc beginning values}
upstrtd += 1;
uphighest = high;
upalpha = aMin;
uppstop_next = low-upAllow;
end else if upstrtd = 0 then begin
{calc next value in sequence}
if low <= uppstop_next[1] then begin
{we_ve hit the stop. end of indicator.}
upstrtd += 1;
uppstop_next = 0;
end else begin
{haven_t yet hit stop, direc is up}
upMoveX = uphighest - uppstop_next[1];
uppstop_next = uppstop_next[1] + upalpha*upMoveX;
upclosest = low;
if low[1] < low then upclosest = low[1];
if uppstop_next > upclosest then uppstop_next = upclosest;
if high > uphighest then begin
uphighest = high;
upalpha = upalpha + upaAccel;
if upalpha > aMax then upalpha = aMax;
end;
end; {low cmp pstop}
end;
if dnstrtd = -1 and
Arw_GetBarNumber(arrowDnId) = BarNumber
then begin
{calc beginning values}
upstrtd += 1;
uphighest = high;
upalpha = aMin;
dnpstop_next = high+dnAllow;
end else if dnstrtd = 0 then begin
{calc next value in sequence}
if high >= dnpstop_next[1] then begin
{we_ve hit the stop. end of indicator.}
dnstrtd += 1;
dnpstop_next = 0;
end else begin
{haven_t yet hit stop, direc is down}
dnMoveX = dnpstop_next[1] - dnlowest;
dnpstop_next = dnpstop_next[1] - dnalpha*dnMoveX;
dnclosest = high;
if high[1] > high then dnclosest = high[1];
if dnpstop_next < dnclosest then dnpstop_next = dnclosest;
if low < dnlowest then begin
dnlowest = low;
dnalpha = dnalpha + dnaAccel;
if dnalpha > aMax then dnalpha = aMax;
end;
end; {high cmp pstop}
end; {strtd status}
end; {barStatus}
- Attachments
-
- ESd-tr.wsp
- (509.64 KiB) Downloaded 518 times
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Study is missing Data -1. Please set up your chart data.
The error message means that your study requests a detaseries number/index that does not exist on your chart (you can check it in the Format->Instruments tab).So I take it nobody is able to tell me what the error message means.
-
- Posts: 43
- Joined: 01 Dec 2008
- Has thanked: 2 times
- Been thanked: 2 times
Re: Study is missing Data -1. Please set up your chart data.
Well, the keyword "data" (as in data2) does not appear in the study. Is there another way to "request" a data series?your study requests a detaseries number/index that does not exist on your chart
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Study is missing Data -1. Please set up your chart data.
RWDickinson, please post the code of the RD_ScreenVPos function.
-
- Posts: 43
- Joined: 01 Dec 2008
- Has thanked: 2 times
- Been thanked: 2 times
Re: Study is missing Data -1. Please set up your chart data.
yep, here.RWDickinson, please post the code of the RD_ScreenVPos function.
------------ code ------------
{RD_ScreenVPos returns a price value that lies at the given
%age of screen vertical space. i.e. 0% lies at bottom of
screen, 100% lies at top of Screen
}
Inputs:
Percentage(NumericSimple); //0-100
Variables:
high1 (0),
low1 (0);
high1 = GetAppInfo(aiHighestDispValue);
low1 = GetAppInfo(aiLowestDispValue);
RD_ScreenVPos = (high1 - low1)*Percentage/100 + low1;
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Study is missing Data -1. Please set up your chart data.
This case has been forwarded to our engineers. We will contact you once there are any updates.
- ABC
- Posts: 721
- Joined: 16 Dec 2006
- Location: www.abctradinggroup.com
- Has thanked: 125 times
- Been thanked: 409 times
- Contact:
Re: Study is missing Data -1. Please set up your chart data.
I ran into a similar error message using TL_New_Bn and later trying to move the TL using TL_SetEnd_Bn. As RWDickinson you are Arw_new_bn this issue might be related.
I was able to cure the issue by checking that the TL ID is larger than zero before moving it.
Without checking for TLID > 0 the error "Study is missing Data -1" pops up. With the check the study works fine.
Maybe this helps you in fixing your study or it helps MC in tracking down the issue.
Regards,
ABC
I was able to cure the issue by checking that the TL ID is larger than zero before moving it.
Code: Select all
TLID= TL_New_Bn...
...
if TLID > 0 then
TL_SetEnd_Bn...
Maybe this helps you in fixing your study or it helps MC in tracking down the issue.
Regards,
ABC
-
- Posts: 43
- Joined: 01 Dec 2008
- Has thanked: 2 times
- Been thanked: 2 times
Re: Study is missing Data -1. Please set up your chart data.
Thanks for the tip.Maybe this helps you in fixing your study or it helps MC in tracking down the issue.
I just tried "if ...Id = 0 ..... Print("Error message");" for each of my elements. Still get MC error as above, and did not get my error message in the output window. Do we know whether user-printed messages always appear in the output if they are immediately followed by a MC error?
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Study is missing Data -1. Please set up your chart data.
The text of the error message is incorrect. We will fix it in MultiCharts 9.0 beta 1.
This message appears when the first parameter for tl_setbegin_bn is "-1". Checking that ID > 0 is not the correct way of working it around. You need to ensure the drawing with the required ID exists (TL_Exist()) to avoid the error.
This message appears when the first parameter for tl_setbegin_bn is "-1". Checking that ID > 0 is not the correct way of working it around. You need to ensure the drawing with the required ID exists (TL_Exist()) to avoid the error.
-
- Posts: 43
- Joined: 01 Dec 2008
- Has thanked: 2 times
- Been thanked: 2 times
Re: Study is missing Data -1. Please set up your chart data.
Well, I'm not using TL (that was ABC who thought there might be a connection), but I take it this applies to my use of Arw and Text, also. I'll check it out.
-
- Posts: 43
- Joined: 01 Dec 2008
- Has thanked: 2 times
- Been thanked: 2 times
Re: Study is missing Data -1. Please set up your chart data.
TL_Exist(), Arw_Exist(), Text_Exist() do not exist (in the help screens).
I'll try them anyway.
Text_Exist() does exist (study compiles)
Arw_Exist() does not exist (study does not compile)
So I'm still using ...Id <> 0 for arrows.
I'll try them anyway.
Text_Exist() does exist (study compiles)
Arw_Exist() does not exist (study does not compile)
So I'm still using ...Id <> 0 for arrows.
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Study is missing Data -1. Please set up your chart data.
RWDickinson, unfortunately there is no Arrow_Exist at the moment. We will add it in one of the future versions. As a workaround you can check the existence of the arrow drawing using the following code:
Code: Select all
If (arw_getcolor(ID) >= 0) then begin
-
- Posts: 43
- Joined: 01 Dec 2008
- Has thanked: 2 times
- Been thanked: 2 times
Re: Study is missing Data -1. Please set up your chart data.
Well, I've given up (as with several other problems w/ MC). Sometimes I get the error message, sometimes the code runs and symbols show up momentarily then disappear, sometimes the code runs but no symbols appear at all.
I did find on a previous problem that text drawn on the last bar on chart will disappear as soon as next tick arrives, so it has to be deleted and recreated on each tick. Maybe that's my problem. But, as I say, I've given up.
Thanks for the answer to my original question. At least that question is solved.
I did find on a previous problem that text drawn on the last bar on chart will disappear as soon as next tick arrives, so it has to be deleted and recreated on each tick. Maybe that's my problem. But, as I say, I've given up.
Thanks for the answer to my original question. At least that question is solved.