EDIT: Forgot to mention this is USA FIFO non-counter trading crims.
I have a question regarding the trade signals that I can't seem to wrap my head around.
I want to do two things with one trade signal at the same time or more precisely I want to close a trade and then open the opposite trade.
For example if Condition Sell signal arrives can we do a BuyCloseSignal=true then on next line SellSignal = true?
Here's my code
Code: Select all
//+------------------------------------------------------------------+
//| Begin Buy/Sell Signals |
//+------------------------------------------------------------------+
//Buy signal
if(S3LongSignal)
if(ObjectFind(S1BuyLineName)>-1)//There is a buy line
if(iOpen(Symbol(),TradingTimeFrame,1) < S1BuyLinePrice)//Open < BuyLinePrice
if(iClose(Symbol(),TradingTimeFrame,1) > S1BuyLinePrice)//Cross upwards of the buy line
{
SellCloseSignal = True; //First close any sells that are open
BuySignal = True; //Second open a buy trade
}
//Buy signal
if(S2LongSignal)
if(ObjectFind(S1BuyLineName)>-1)//There is a buy line
if(iOpen(Symbol(),TradingTimeFrame,1) < S1BuyLinePrice)//Open < BuyLinePrice
if(iClose(Symbol(),TradingTimeFrame,1) > S1BuyLinePrice)//Cross upwards of the buy line
{
SellCloseSignal = True; //First close any sells that are open
BuySignal = True; //Second open a buy trade
}
Appreciate your sage advice
David