PureBytes Links
Trading Reference Links
|
Hi,
I've been trying to get a code to work for two days now and I can't see what
I'm doing wrong so if someone could point out my error I would be very
grateful.
The thing is that I'm trying to build a system which is comprised of two
systems, one basic signal and then an add-on signal which will add to the
original position.
I would like to evaluate the add-on part and thus I will have to let
TradeStation know when it can trade the add-on signal which demands an
original open position. I've been trying to build this into the signal but
because of some bugs in TradeStation I can't get it to work. To solve the
problem I've built a textfile from the original signal with data for every
bar as follows:
Date,Time,MarketPosition
I then put this data into arrays in a function that I call MPosition and
looks like this:
*********************************************************
Inputs: CurrentDate(NumericSimple),CurrentTime(NumericSimple);
Vars: Found(False), Count(0);
Array: arrDate[20000](0), arrTime[20000], arrMP[20000];
arrDate[0]=1011031;
arrTime[0]=0900;
arrMP[0]=0;
arrDate[1]=1011031;
arrTime[1]=0910;
arrMP[1]=-1;
etc.etc.etc.
whild Found = False begin
if CurrentDate = arrDate[Count] and CurrentTime = arrTime[Count] then
begin
MPosition = arrMP[Count];
Found = True;
end
else
MPosition = 0;
Count = (Count + 1);
end;
Count = 0;
Found = False;
**************************************************************
>From my trading code I then have a variable that looks like this:
LongShort = MPosition(Date,Time);
This should return the current marketposition from the function but it just
gives me 0 all the time.
/Stefan Johansson
Sweden
|