edward
08-08-2007, 08:16 PM
I have written a ninja script(mostly through the wizard). In the script, I am using an ATM strategy. I have found that I am entering trades when I am already in one. I have tried putting in pieces of code to keep this from happening, but without success. Here are a few of the ways I have tried. As you can see, I am trying anything in the hopes that it works. Obviously, I am not an advanced programmer. Any help would be appreciated.
1.
protectedoverridevoid OnBarUpdate()
if (GetAtmStrategyMarketPosition(OrderId) != MarketPosition.Flat)
return;
2.
protectedoverridevoid OnBarUpdate()
if (GetAtmStrategyMarketPosition(
atmStrategyId) != MarketPosition.Flat)
return;
and
3.
// Condition set 1
if (ToTime(Time[0]) >= ToTime(8, 45, 00)
&& ToTime(Time[0]) <= ToTime(14, 50, 00)
&& Position.MarketPosition == MarketPosition.Flat
etc...
4.
// Condition set 1
if (ToTime(Time[0]) >= ToTime(8, 45, 00)
&& ToTime(Time[0]) <= ToTime(14, 50, 00)
&& GetAtmStrategyMarketPosition(OrderId) == MarketPosition.Flat
etc...
The log shows an error:
GetAtmStrategyMarketPosition() method error: AtmStrategyId '1dfde556491458491db1e6eeee761d0' does not exist
Edward
1.
protectedoverridevoid OnBarUpdate()
if (GetAtmStrategyMarketPosition(OrderId) != MarketPosition.Flat)
return;
2.
protectedoverridevoid OnBarUpdate()
if (GetAtmStrategyMarketPosition(
atmStrategyId) != MarketPosition.Flat)
return;
and
3.
// Condition set 1
if (ToTime(Time[0]) >= ToTime(8, 45, 00)
&& ToTime(Time[0]) <= ToTime(14, 50, 00)
&& Position.MarketPosition == MarketPosition.Flat
etc...
4.
// Condition set 1
if (ToTime(Time[0]) >= ToTime(8, 45, 00)
&& ToTime(Time[0]) <= ToTime(14, 50, 00)
&& GetAtmStrategyMarketPosition(OrderId) == MarketPosition.Flat
etc...
The log shows an error:
GetAtmStrategyMarketPosition() method error: AtmStrategyId '1dfde556491458491db1e6eeee761d0' does not exist
Edward