I just created a strategy. Maybe someone can take a look, if there is a mistake in the source code, since it doesn't generate a single trade if I run the strategy analyser. This is how it is supposed to work:
I look at the High and the low of an initial period between 09.30 to 10.00. The distance between that high and low should be at least 20 points (not ticks), which is calculated by Variable0. If this is true, Variable5 gets the Value 1 and the strategy is supposed to trade for the day.
After 10, I place two orders whether to buy at the low of that initial period or to sell short at the high of that period. I don't enter any position after 11, and once I am in a position (Variable9 gets the Value 1), I don't open another one.
If I am long by 11, I try to sell on a limit, which is the high of the initial period minus 10 ticks (Limitprice should be denoted by Variable3). If I am short, I try to buy on a limit, which is the low plus 10 ticks (Limitprice should be denoted by Variable4).
If I am still in a position by 12, I exit via a market order.
Here's the source code:
// Condition set 1
if (ToTime(Time[0]) == ToTime(10, 00, 0))
{
Variable1 = High[30];
Variable2 = Low[30];
Variable3 = High[30] - 10 * TickSize;
Variable4 = Low[30] + 10 * TickSize;
Variable0 = (High[30] - Low[30]);
Variable9 = 0;
}
// Condition set 2
if (Variable0 >= 20)
{
Variable5 = 1;
}
// Condition set 3
if (Variable5 == 1
&& ToTime(Time[0]) < ToTime(11, 00, 0)
&& ToTime(Time[0]) > ToTime(10, 00, 0)
&& Position.MarketPosition != MarketPosition.Short
&& Variable9 != 1)
{
EnterLongLimit(DefaultQuantity, Variable2, "long");
}
// Condition set 4
if (Variable5 == 1
&& ToTime(Time[0]) < ToTime(11, 00, 0)
&& ToTime(Time[0]) > ToTime(10, 00, 0)
&& Position.MarketPosition != MarketPosition.Long
&& Variable9 != 1)
{
EnterShortLimit(DefaultQuantity, Variable1, "short");
}
// Condition set 5
if (Position.MarketPosition == MarketPosition.Long)
{
ExitLongStop(Variable3, "exitlong", "long");
Variable9 = 1;
}
// Condition set 6
if (Position.MarketPosition == MarketPosition.Short)
{
ExitShortStop(Variable4, "exitshort", "short");
Variable9 = 1;
}
// Condition set 7
if (ToTime(Time[0]) == ToTime(12, 00, 0)
&& Position.MarketPosition == MarketPosition.Long)
{
ExitLong("", "long");
}
// Condition set 8
if (ToTime(Time[0]) == ToTime(12, 00, 0)
&& Position.MarketPosition == MarketPosition.Short)
{
ExitShort("", "short");
}

Comment