"Cannot implicitly convert type" error on WSTL translated script
Author: gfullmer
Creation Date: 4/9/2009 4:32 PM
profile picture

gfullmer

#1
I am trying to get an old script translated. The translator works OK without errors but when I try to compile the resultant script I get errors. The code has to do with:

public ChartPane MPane, StochPane, ADXPane;

and

MPane = CreatePane(100, true, true);

And I get an error message that says:

errorCS0029 @ [201,10} : Cannot implicitly convert type 'int' to 'WealthLab.ChartPane'

I played around with the types, but isn't CreatePane type ChartPane and not integer. I am a newbie at translation stuff. Is CreatePane being overloaded as type int? If, so how? How do I fix this?

Here is all of the code:
CODE:
Please log in to see this code.
profile picture

DrKoch

#2
If your original script worked in WL4, then the translated should work in WL5.
The script posted above is certainly not what the translator produced.

Background:
The Translator translates syntax, not semantics. This means among other things that types
are unchanged from WL4 scripts.

The function WealthScriptTL.CreatePane() returns an int (like the WL4 CReatePane())
It is inside the "Compatibility class" WealthScriptTL where the int pane handles are used to access WL5 ChartPanes.

Modify the line
public ChartPane MPane, StochPane, ADXPane;
to read
public int ChartPane MPane, StochPane, ADXPane;


profile picture

gfullmer

#3
You are correct. I played a lot with it after translation. So I went back and re-translated it and that
fixed the error message. It appears that WL_SOLID is not defined but after changing that reference to 1
it compiled fine. However, I am getting run-time error message on a different part of the code:

Runtime error:Value cannot be null.
at WealthLabCompile2.Strategy.Executed()
at finantic.TL.WealthScriptTL.DrawImage(String bitmap, Int32 pane, Int32 bar, Double price, Boolean topDown) in D:\Projects\Visual Studio 2005\Projects\
at System.IO.Path.Combine(String path1, String path2)

I think the offending type of line is:

CODE:
Please log in to see this code.


Thanks for your help,
Glen


profile picture

DrKoch

#4
What DrawImage() does:

It looks up
HKCU\Software\\Wealth-Lab\\Wealth-Lab Developer 3.0\Directroy
in the registry, reads the path and appends
Bitmaps, <your image name>, .bmp
then calls the original WL5 DrawImage() with the full path.

This means,
.\Bitmaps\uptrianglegreen.bmp
must exist in the old WL3/WL4 installation directory.
profile picture

gfullmer

#5
Danke, Doctor K. Are there any built in bitmaps that I can use and maybe override their colour?

Glen
profile picture

gfullmer

#6
P.S. Does the Bitmaps directory still work?
profile picture

DrKoch

#7
You have several options:
1. save your bitmaps in the WL4 bitmap folder (see above)
2. use the WL5 DrawImage() function with an arbitrary path.

To get the original function you'll have to prepend the correct namespace.
profile picture

gfullmer

#8
Anyone have the old bitmaps that came as default with WL-4? I don't think I can get the installation software for WL-4 to get them.

Thanks,
Glen
profile picture

Eugene

#9
Just for kicks -- poor man's trade arrows:
CODE:
Please log in to see this code.
profile picture

TrendCatcher

#10
I would like to try incorporating the above code. Could you be more specific as to which lines or portion of the code to be replaced. Thanks.
profile picture

Eugene

#11
If you mean gfullmer's code above, the idea is to replace all down triangles/arrows as follows:
CODE:
Please log in to see this code.

And up triangles/arrows are getting replaced like this:
CODE:
Please log in to see this code.
profile picture

TrendCatcher

#12
Thank you. I will just keep the original, as I modified with some indicators and with your input I changed the panes around. So hard change all over. I though I would try if it is within the original and certainly not if the code from above(gfullmer's). Hope I will be a programmer sometime. :)
profile picture

TrendCatcher

#13
I always ask questions based on the original and do not like to confuse who is helping.
profile picture

Eugene

#14
I have no idea what "the original" is because in this thread (started by gfullmer), the original appears to be gfullmer's code. Nonetheless, I believe this is a sufficient hint -- what's left for you is to use the Find dialog (Ctrl-F) in the Editor, comment out the DrawImage lines that plot the green/red arrows in your script, and insert my lines (respectively).
profile picture

TrendCatcher

#15
Thank you.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).