RazzParticipant
Master
Hi
I want my trading system to only do 3 trades a day, what do I have to do?
I don’t know what to do next
Thank you
once Tradetag=0
If onmarket then
Tradetag=date
endif
If not onmarket and time>= Startzeit and time < Endzeit and Tradetag<>date and Spannepoints < MaxBox then
BUY Position Lot AT Hi+L Stop
Sellshort Position Lot AT Lo-S Stop
Try this, it should work.
if intradaybarindex = 0 then
countposition=0
endif
condnbposperday=countposition <= 3
if not longonmarket and condition and condnbposperday then
buy 1 shares at market
countposition=countposition+1
endif
Mauro – your suggestion only works for at market orders. Razz’s example uses stop orders and so it is that a trade can be opened and closed within a candle. This means that simply adding one to a count does not work and using COUNTOFPOSITION does not work as the count would be zero at the candles close in this case.
We need to check both COUNTOFPOSITION and STRATEGYPROFIT at the candles close. Nicolas has a code snippet which hopefully he will share again here soon.
The problem is that Razz is using pending stop orders and so you can’t increase an order count each time you set them, but when they are actually triggered.
Try with this snippet:
if intradaybarindex=0 or day<>day[1] then
count=0
endif
if ( (not onmarket and onmarket[1] and not onmarket[2]) or (tradeindex(1)=tradeindex(2) and tradeindex(1)=barindex[1] and tradeindex(1)>0) or (not onmarket and onmarket[1])) then
count=count+1
endif
if count<3 then
...
endif
“soon” means at the same exact time Vonasi 😆
“soon” means at the same exact time Vonasi 😆
I knew you were fast but not that fast!
RazzParticipant
Master
Thank you for your help, I hope I entered it correctly. I watch how it works.
if intradaybarindex=0 or day<>day[1] then
count=0
endif
if ( (not onmarket and onmarket[1] and not onmarket[2]) or (tradeindex(1)=tradeindex(2) and tradeindex(1)=barindex[1] and tradeindex(1)>0) or (not onmarket and onmarket[1])) then
count=count+1
endif
if count<3 then
Trade=1
endif
If not onmarket and time>= Startzeit and time < Endzeit and Trade=1 and Spannepoints < MaxBox then
BUY Position Lot AT Hi+(Spread/2) Stop
Sellshort Position Lot AT Lo-(Spread/2) Stop
Thank you
It will not work as you never reset “Trade” to 0. You should do it like this:
if intradaybarindex=0 or day<>day[1] then
count=0
endif
if ( (not onmarket and onmarket[1] and not onmarket[2]) or (tradeindex(1)=tradeindex(2) and tradeindex(1)=barindex[1] and tradeindex(1)>0) or (not onmarket and onmarket[1])) then
count=count+1
endif
If not onmarket and time>= Startzeit and time < Endzeit and count<3 and Spannepoints < MaxBox then
BUY Position Lot AT Hi+(Spread/2) Stop
Sellshort Position Lot AT Lo-(Spread/2) Stop
RazzParticipant
Master
I probably did something wrong, in the picture all 3 systems. 2 trades are not ok
if intradaybarindex=0 or day<>day[1] then
count=0
endif
if ( (not onmarket and onmarket[1] and not onmarket[2]) or (tradeindex(1)=tradeindex(2) and tradeindex(1)=barindex[1] and tradeindex(1)>0) or (not onmarket and onmarket[1])) then
count=count+1
endif
if count<3 then
Trade=1
endif
If not onmarket and time>= Startzeit and time < Endzeit and Trade=1 and Spannepoints < MaxBox then
BUY Position Lot AT Hi+(Spread/2) Stop
Sellshort Position Lot AT Lo-(Spread/2) Stop
ENDIF
// Stops und Targets
SET STOP pLOSS Spannepoints*y
SET TARGET pPROFIT Spannepoints *x
RazzParticipant
Master
Thanks Nicolas the new code is better but he is still buying a position he is not allowed to.
please look at the Picture.
Many thanks for your help
Why not allowed?, the max position is set to 3 per day and I count 3 orders on your last screenshot.
RazzParticipant
Master
3 trades are ok, but the 3 entry must not be, condition should be that the Lo of the range 0800-0900 is the signal.
RazzParticipant
Master
Nicolas I work limited to 2 trades per day, the results have changed very well. less profit trading but more profit. I will continue to watch the whole thing and if I really run the strategy in the real account a programmer should look over there.
Nicolas,Vonasi,Mauro
Many thanks for your help
Good afternoon. I am sorry that I get involved in the Razz issue. I have a similar system in which instead of limiting the number of daily orders, I limit the number of lost orders.
I comment because your system reminds me of one that I have, based on the Mark Fisher ACD system. In this system, the maximum and minimum are set in a time range, but those values are not entered, but the maximum amount is added by the percentage of the average true range value of the previous day and the minimum is subtracted That same percentage. This prevents us from false breaks.
As you can see on the screen you have said you say that the last operation is not allowed, however, notice, that it returns almost to the initial position (that is, at the minimum of the range), then go back down and have a very good operation.
It is simply an idea.
RazzParticipant
Master
Nicolas the code for the 3 trades works, but unfortunately the entry conditions after the 1 trade no longer work. Entry should only be if it goes over the High Line or under the Low Line. If I use crosses over / under it only starts with the next candle. Do you have a solution?
Thank you
once Bars=60
once Hi=0
once Lo=0
If time = 090000 then
Hi=highest[Bars](high)
Lo=lowest[Bars](low)
endif
Spannepoints=(Hi-Lo)/pointsize
MaxBox = MB
if intradaybarindex=0 or day<>day[1] then
count=0
endif
if ( (not onmarket and onmarket[1] and not onmarket[2]) or (tradeindex(1)=tradeindex(2) and tradeindex(1)=barindex[1] and tradeindex(1)>0) or (not onmarket and onmarket[1])) then
count=count+1
endif
If not onmarket and time>= Startzeit and time < Endzeit and count<3 and Spannepoints < MaxBox then
BUY Position Lot AT Hi+(Spread/2) Stop
Sellshort Position Lot AT Lo-(Spread/2) Stop
ENDIF
// Stops und Targets
SET STOP pLOSS Spannepoints*y
SET TARGET pPROFIT Spannepoints *x