I have often developed programs that use data that TradeStation may not have in their database, and later wanted to use the signals generated on that data and it apply it to another market. Here is a simple program that uses arrays to specify trade dates and signals. The code to interpret the arrays and then execute the orders follows:
array: DateArray[1000](0),BorSArray[1000]("");
vars: iCnt(1);
DateArray[1]=1081228; BorSArray[1]="S";
DateArray[2]=1081229; BorSArray[2]="B";
DateArray[3]=1090104; BorSArray[3]="S";
if date >= dateArray[1] then
begin
if date = dateArray[iCnt] then
begin
if BorSArray[iCnt] = "B" then buy this bar on close;
if BorSArray[iCnt] = "S" then sellShort this bar on close;
iCnt = iCnt + 1;
end;
end;
Notice how arrays are defined and declared. How do you think you would handle a system that goes flat?
Discover more from George Pruitt
Subscribe to get the latest posts sent to your email.