PaulParticipant
Master
Hi I wonder if you can use the same code for stock as well as futures in the correct settings. Something like this below, but it doesn’t work.
///setup_futures 1 - setup_stock 2
setup=1
Positionsize = 1
Cashsize = 10000
// long entry
if not longonmarket and detector = 1 and (detector[1] = 0 or detector[1] = -1) then
if setup=1 then
buy Positionsize lot at market
endif
if setup=2 then
buy cashsize shares at market
endif
endif
//stops (no trailing stop with futures)
if setup=1 then
SET STOP %LOSS 1
endif
if setup=2 then
SET STOP %LOSS 1
SET STOP %TRAILING 2
Endif
Any Tips ?
Thanks! Paul
Moderator’s edit: message edited for you to make appear the proper format for PRT code. Please use the “<>” button (insert PRT code button) next time. Thanks you.
Topic moved to ProOrder section since it deals with automatic trading.
This code should operate the same for any instrument, as long as your “Positionsize” is set to a correct value for each of the instrument you’d like the code to operate with (minimal contract value could be different from a security to another).