Hey guys!
I just made some multitimeframe systems and I want them to exit the trade at the open of the next bar in the bigger timeframe.
Can you help me out?
For Example:
timeframe (5 minutes)
// Bedingungen zum Triggern von Long-Positionen
indicator1 = xxx
c1 = (close < indicator1)
// Bedingungen zum Triggern von Short-Positionen
indicator3 = xxxx
c3 = (close > indicator3)
//Bedingugngen zum Einstieg in Long-/Shortpostitionen
timeframe (10 seconds)
if not longonmarket and c1 then
buy 1 contract at indicator1 stop
endif
if not shortonmarket and c3 then
sellshort 1 contract at indicator3 stop
endif
// GET OUT RULES??????
Exit trade when a new candle opens in TF 5 ( WHAT IS THE CODE FOR THAT)
THank you!
I tried this:
IF BarIndex – TradeIndex = x Then
Sell at Market
ExitShort at Market
But if I write it under timeframe (5 Minutes) it doesnt exit anyway.
If i write it under timeframe (10 seconds) it exits after a specific amount of bars, but not at the open of the new candle in the 5 min tf.
You need to use below …
timeframe (5 minutes, updateonclose)
what will that change for the closing of my order?
this just delays my entry…..
See if attached does what you want it to ?
I used 1 min (in place of 5 min) because 1 min produced more trades.
my problem is no the buying or how much trades the system produces. — I am opening orders in the 10 second timeframe,
My proplem are the exits. — I want to exit in the 5 minute timeframe.
No matter when my trade is opened, i want to end it as soon as the next 5 minute bar opens.
the code must be something like:
for longpositions:
if longonmarket then sell next bar at open in timeframe (5 minutes)
for shortpositions:
if shortonmarket then exitshort next bar at open in timeframe (5 minutes)
Strategies are only executed when a bar closes. At that time you will be able to open or close any trade, no choice.
To be able to close, in a 5-minute TF, when the, say, 080000 candle opens, you need to place the exit order when the 075500 candle closes.
Another solution could be to use a 1-second TF so that you close the trade at the closing of the 080000 1-second TF, that is at 080001.
I know. I think you dont understand me.
My system is buying in the 10 second chart when a buysignal is given in the 5 min chart.
And my problem is: I want the system to sell when a new candle is opened in the 5 min chart. And i dont have the code for that.
I need the code for:
timeframe (5 minutes)
EXIT = ……………………………… <————– what is the condition to sell next bar at open in the 5 minute timeframe?
timeframe (10 seconds)
If longonmarket and EXIT then
sell at market
endif
If shortonmarket and EXIT then
exitshort at market
endif
To exit when a candle opens you have to exit when the previous bar closes.
To exit at 080000 you have to exit at the closing of the 075500 candle.
IF Time = 080000 THEN
// exit here
ENDIF
in the 5-minute TF (in the 10-second TF you should use 075550).
But i dont know when my system is opening a trade.. so how should i know the exact time when to close it?
I want the system to be flat, everytime a new candle opens in the t5 minute time frame.
That’s easy, just exit as the beginning of your code. It will ALWAYS close any open trade:
Timeframe (5 minutes, updateonclose)
SELL AT Market
EXITSHORT AT Market
there’s no need to check if already OnMarket, as if it’s not the two instructions are ignored. And if you are in a Long position EXITSHORT will be ignored (and the opposite for SELL).
THANK YOU!
Thats what i was looking for, thank you VERY MUCH!!!!!!