Welcome to NexusFi: the best trading community on the planet, with over 150,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 -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
PowerLanguage & EasyLanguage. How to get the platform name with code?
How would it be possible to get the platform name or any kind of distinctive name reference with PowerLanguage and EasyLanguage? to in that way run some different syntax depending on the platform is running, because PowerLanguage and EasyLanguage syntax are not always exactly the same.
I've seen you can get the app id with aiApplicationType but it would not be the solution for this situation.
Thank you
Can you help answer these questions from other members on NexusFi?
I am not aware of such a reserved word. For simplicity and for maximizing the capabilities of the languages it might make sense to simply keep the codes separated.
And you should know @futurenow that if anyone here would know this, it is @ABCTG - one of the most knowledgeable Easy Language programmer here, in my opinion.
@futurenow, even if you would come up with a way to identify the platform (which you probably could do by finding one reserved word that only exists in one platform and for which you would have to create a function in the other platform, so you could distinguish by the return values) the obstacle that you will not be able to overcome is the compiler in the platforms. If your code contains reserved words that the compiler does not recognize it will throw an error and you will not be able to compile your code. This is what would happen in both platforms, if you have code that is exclusive to the other platform only.
Yes, I understand the point about "For simplicity and for maximizing the capabilities of the languages" and about "If your code contains reserved words that the compiler does not recognize it will throw an error and you will not be able to compile your code".
However, even with that, the part about to know what is the platform or any other way to for example identify the language name or anything like that, could be useful in a couple scenarios.
If someone want to share any idea about this, it will be welcome.
I provided you with an idea for an approach on how to do the identification in my previous post. However, it will require a bit of innovation on your part.
If PlatformType="Tradestation" then begin
//special code run only in TS
end;
Probably do simplistic for you, but then again I have no idea why this would be needed. If I have code in Tradestation, I know I am running in Tradestation. And if the code is in MultiCharts, I generally know that too. Maybe you are doing something way out of my league though...
I think you refer to the part of "which you probably could do by finding one reserved word that only exists in one platform and for which you would have to create a function in the other platform, so you could distinguish by the return values".
Yes, that idea would be a way, thank you. What I meant in the last post was about that if maybe could be another more direct and automatic way, then it will be welcome, just if someone has had a similar situation and has found any more direct solution.
This is just for some simple situations like for example if the code will print text, then do it with a specific text format, etc. depending on the platform is running, so not anything too fancy.
Yes, of course the person knows if the code is running in MC or TS, but in this case the point is that the code itself can get this reference automatically in a way the person doesn't need to specify it.
By the way, the solution you show just specifying it with an input works as should, thank you for posting the idea, but this requires you remember to type the platform name or language name in the input which I perfectly understand is a valid situation, but the main question in this thread is about any simple way that can do something equivalent automatically, for example like a way to know the language name:
`if GetLanguageName = "PowerLanguage" then {run logic A} else {run logic B};`