Hello, good morning, Thank you for reading me in advance.
I have a problem and I'm wondering if you can help me please.
I want to put in my script
1 "BuyStop" above the current price.
1 a "SellStop" below the current price.
But only execute the first one in the line.
Example:
if ((Close[0] > MINIMUM)
&& (TRADING_CONTROL == true)
&& (Close[0] < MAXIMUM))
{
EnterLongStopMarket(3, ASK + (30 * TickSize),, @"LONG"); //BUYSTOP
EnterShortStopMarket(3, BID - (30 * TickSize), @"SHORT"); //SELLSTOP
}
If I reverse the lines, it still only executes 1 order.
Example:
if ((Close[0] > MINIMUM)
&& (TRADING_CONTROL == true)
&& (Close[0] < MAXIMUM))
{
EnterShortStopMarket(3, BID - (30 * TickSize), @"SHORT"); //SELLSTOP
EnterLongStopMarket(3, ASK + (30 * TickSize),, @"LONG"); //BUYSTOP
}
My automatic strategy is based on entering a trade by breaking the price range or distribution.
The code would be more or less like this:
-------------------------------------------------------------------------------------------------------------------------------------
else if (State == State.Configure)
{
TRADING_CONTROL = true;
}
if ((Close[0] > MINIMUM)
&& (TRADING_CONTROL == true)
&& (Close[0] < MAXIMUM))
{
EnterLongStopMarket(3, ASK + (30 * TickSize),, @"LONG"); //BUYSTOP
EnterShortStopMarket(3, BID - (30 * TickSize), @"SHORT"); // SELLSTOP
}
if (Position.MarketPosition == MarketPosition.Short)
TRADING_CONTROL = false;
if (Position.MarketPosition == MarketPosition.Long)
TRADING_CONTROL = false;
…
if (Position.MarketPosition == MarketPosition.Long)
{
ExitLongStopMarket(3, BID - (100 * TickSize), "SL ", "");
ExitLongLimit(3, ASK + (200 * TickSize)), "TP", "");
}
if (Position.MarketPosition == MarketPosition.Short)
{
ExitShortStopMarket(3, ASK + (100 * TickSize), @"SL ", "");
ExitShortLimit(3, BID - (200 * TickSize)), "TP", "");
}

Comment