Tradestation 8 coding help

pecas

Member
75 6
Cheers,
I have a workspace with four charts running strategies.

In each strategy I have inputs to compute how many contracts I should trade.

It's easy math, there's an input named MaxRisk, one named BankRoll, and another named MarginRequired: I trade the number of contracts that fit my MaxRisk setting, but also the Margin Requirements related to my bankroll. So if risk settings say trade 10x, but I have the margin for 5, I trade 5.

Now the problem arises when two trades happen at the same time. I'm using my bankroll to trade a future, how to tell the strategy in the other chart that $ X are busy with another trade? I didn't find anything in EasyLanguage that refers to this; maybe there's something related to your account if you trade with Tradestation brokerage, but I don't, so that's useless.
 

ManiGandan

Junior member
34 3
Hi Pecas,

You can use Globalvariables to send information from one chart to another chart..
Post a PM to me if you have any difficulties...

Manigandan.
 

ManiGandan

Junior member
34 3
Hi Pecas,

No Need, Tradestation has its own Globalvariables.dll and its functions that can be used in Tradestation Easylanguage which was created by Tradestation users.

Thanks,
Manigandan.
 

pecas

Member
75 6
OK, thanks a lot. I'm out for the weekend but will try this on Manday and be back at you with results.
 

pecas

Member
75 6
I tried using GlobalVariables, but I can't verify my strategy... It's a strange error on this line:
Code:
	SetRtn1 = GVSetDouble(0,FreeMargin);
I get the following error: Grammar Error - Numerical expression expected here.
Like if "GVSetDouble(0,FreeMargin)" is not considered a number.
"FreeMargin" is a variable, and I copied the line from an example indicator that verifies correctly :?:


EDIT: forget about it... error was on line above..
 
Last edited:

Albert Carey

Member
88 3
At what point does TS update the value of the global variables? At the beginning of a bar, at the close, or real-time? Be very careful. These high level languages are known to be based on a lot of conditions.
 

pecas

Member
75 6
I have an indicator that plots the value of global variables, just to stay safe.
The option "update the value intra-bar" is on.
It's my strategy that sets the value of the global variable, so all depends on the "Calculation" options. If I allow the strategy to calculate only once per bar, then GVs will update once per bar; if I allow tick by tick calculation, they will be updated tick by tick.
At the moment, once per bar suits my strategy.
 

Similar threads


AdBlock Detected

We get it, advertisements are annoying!

But it's thanks to our sponsors that access to Trade2Win remains free for all. By viewing our ads you help us pay our bills, so please support the site and disable your AdBlocker.

I've Disabled AdBlock