Welcome to NexusFi: the best trading community on the planet, with over 200,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- discounts are available after registering.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Trading: Silver(ShangHai AG future contract), China IF index option
Frequency: Several times daily
Posts: 105 since Aug 2017
Thanks Given: 19
Thanks Received: 29
HI guys,
I borrowed the MRA zigzag volume for MC, and deleted some codes which cannot be used in TS and there function not a must right now. The codes now is verified but dose not plot wave leg(zigzag line) or volume text. So please help to check, I cannot figure out why it plots nothing. Thanks!
-----------below is the codes-----------------------
Can you help answer these questions from other members on NexusFi?
is this the original code or the one with your changes? If it's the latter, I'd suggest to also post the original code as this might help tracking the issue down. I would also suggest to post the code within a code box, via the "Wrap [Code] tags around selected text" button.
Trading: Silver(ShangHai AG future contract), China IF index option
Frequency: Several times daily
Posts: 105 since Aug 2017
Thanks Given: 19
Thanks Received: 29
Most of my changes are below
--------------------------------------
if PlotSwings then
begin
if AvgVolume and ( lastLoBar - lastHiBar ) <> 0 then volDn = volDn / ( lastLoBar - lastHiBar );//I use {} to nullify this line,for I don't need it to average the accumulative volume, and this line works in Tradestation if not nullified.
TL_SetEnd_Dt( tl, datetime[0], lastLo );//Ts dose not have _Dt reserve words, I changed to
end;
plotText =
iffString( PlotPriceText, NumToSTr( ( lastLo - lastHi ) * PriceScale, 0 ) + NewLine, "" ) +
iffString( PlotVolumeText, NumToSTr( volDn / ScaleVolumeBy, 0 ) + NewLine, "" ) +
iffString( PlotTimeText, iffString( dailyTF, NumToStr( CurrentBar - lastHiBar, 0 ) + " bar(s)",
DateTimeToHMS( ( ELDateToDateTime( Date[0] ) - ELDateToDateTime( Date[CurrentBar - lastHiBar] ) ) +
ELTimeToDateTime_s( Time_s[0] ) - ELTimeToDateTime_s( Time_s[CurrentBar - lastHiBar] ) ) ), "" );//the function DateTimeToHMS the author wrote does not work in TS, and I don't need it to plot time difference, so I changed this sentence to
for I just need it to plot the volume in text to simplify it
Text_SetLocation_Dt( waveTxt, datetime[0], Low[0]-dis );//same change in the _Dt
Text_SetString( waveTxt, plotText );
end
--------------------------------------------------------------
if PlotSwings then // start new trendline from new swing low to most recent high
begin
if AvgVolume and ( lastHiBar - lastLoBar ) <> 0 then volUp = volUp / ( lastHiBar - lastLoBar );
tl = TL_New_Dt( datetime[CurrentBar - lastLoBar], lastLo, datetime[CurrentBar - lastHiBar], lastHi );//
TL_SetExtLeft( tl, false );
TL_SetExtRight( tl, false );
TL_SetSize( tl, LineWidth );//Ts has no TL_setsize, so I use {} to nullify it.
TL_SetStyle( tl, LineStyle );
TL_SetColor( tl, UpColor );
end;
-----------------------------------------------------
if PlotVolume then
begin
Plot1[x]( VolUp, "Volume Up" );
NoPlot[x]( 2 );
end; //the NoPlot reserve word works different, I use {} to nullify it, for it's ok for me to not plot histogram accumulative volume in a sub-graph. If it can plot, it's better.
------------------------------------------------------------------------
Please check which was changed or deleted in the wrong way, thanks very much.
your best approach might be to start over with the translation and do it block by block while you compare the internal code computations with additional print statements or blocks between MC and TS. This will help you in tracking down where the problem is coming from.
You can also do this with the code changes you made i.e. check with using prints or plots to see if they return a meaningful result.
Trading: Silver(ShangHai AG future contract), China IF index option
Frequency: Several times daily
Posts: 105 since Aug 2017
Thanks Given: 19
Thanks Received: 29
I checked the blocks, and I thinks they are all right. I'm not professional in coding, I think it's the best changes I can made. Could you check them when you are free? I have highlighted my changes .
Thanks very much.
it's not necessarily your code modification, as your modified code plots in MC. I would suggest looking into the parts that draw the text and lines and update their location and I will gladly point you in the right direction when I can.
TS is a bit more sensitive when it comes to drawing/updating text and trendlines. This is an excerpt from the help file for the Text_SetLocation reserved word:
This is most likely what is happening here i.e. your code tries (even if it's just once) to update a text or trendline with an ID that doesn't exist. This is turn, as the quote above clarifies, will not perform any additional text operations.
Adding code to check that the ID you want to update exists (or is greater than the value you used initialized this variable with at least) before you update a trendline or text id might already be the cure.
Trading: Silver(ShangHai AG future contract), China IF index option
Frequency: Several times daily
Posts: 105 since Aug 2017
Thanks Given: 19
Thanks Received: 29
The original zigzag volume indicator for MC first update the zigzag line, then draw new line if new top or bottom is formed. Is this the problem? the original codes for MC have been posted.
Also, I checked in MC, Text_SetLocation and Text_Setlocation in the help file does not have the
Maybe in TS I should first use Text_new to draw new text then use Text_setLocation ?