of course, I just meant your concept.
You could say :
If date = 20180320 and TIME = 073500 then
buy 1 contract at market
endif
to open a position in a system in the 1 minute chart that was started between 7:34 and 7:35 and will have its first bar at 7:35.
Agree ?
Problem may be if you start a system out of hours and there is accidentally no bar at 7:35, no position will be opened.
So, the method with prelaodbars and barindex may be more reliable.
LeoParticipant
Veteran
I have posted a system that opens a position exactly at last minute of opened markets.
As far I understand you want a code that opens a position exactly when it is activated and then controls the trade itself. I think is a very powerful tool for manual trading as default style of trading.
By the way, once I test a code that opens stop and limit orders symulstaniously. Then the first try I had a copy paste problem the result was that it opened a trade “exactly at the moment of activation not at the end of the bar closing. That means for me that prorealtime runs the systems at the moment of activation like running the code at every closing bar.
let us know your progress
to open a position in a system in the 1 minute chart that was started between 7:34 and 7:35 and will have its first bar at 7:35.
It would be a pain having to open the System in the coding window and then enter date and starting Time then back to the system running window then delete the old system (without current date and time) and also you would lose your Performance History. Or am I misunderstanding?
Yes Leo I am also thinking this Snippet could form part as a semi-manual entry, auto close trading Strategy.
Good Work Verdi55
GraHal
I use this:
If not onmarket then
buy 1 contract at market
endif
// Set Stops and Profits
IF StrategyProfit <> 0 then
QUIT
ENDIF
Thanks. Or maybe we could say :
If barindex = tradeindex then
flag = 1
endif
If not onmarket and flag = 0 then
buy 1 contract at market
endif
This would definitely open only 1 position, even if the result of the first position is accidentally zero.
LeoParticipant
Veteran
Here my code. I was not able to open a position exactly when the system is activated rather it opens a position in the next bar.
My code is thought to be a standard
DEFPARAM CumulateOrders = false // Cumulating positions deactivated
DEFPARAM PreLoadBars = 100 //cargar informacion
IF NOT ShortOnMarket THEN
BUY 1 CONTRACTS AT MARKET
SET STOP pLOSS 15
SET TARGET pPROFIT 30
ENDIF
MySAR= SAR[0.005,0.01,0.7]
IF shortonmarket then
IF close crosses under MySAR THEN
EXITSHORT AT MARKET
ENDIF
IF CLOSE-POSITIONPRICE > 7*PIPSIZE THEN
SET STOP pLOSS 1
ENDIF
ENDIF
IF shortonmarket[1] and not shortonmarket then
QUIT
ENDIF
manual trade for me.
MySAR= SAR[0.9999,0.11111,0.222222]
Maybe as an Italian, you will better understand this :
https://www.youtube.com/watch?v=UTO_KF04UiA
LeoParticipant
Veteran
I do not have any clue what are you talking about or why you are posting so weird videos.
What is more weird ? Speculating about 7*PIPSIZE
or such videos ?
LeoParticipant
Veteran
So you were being sarcastic… I got it.
Anyway.
what about the code I posted? What’s your opinion apart of my costant values?