Hi,
I’m new at trading and programming so I wonder if someone can help me to code this for me so I can get started. My request:
Underlying asset: Sverige30 Cash (20sk) Index
Open position after 17:30, after hours trading
Buy when > 1 % down
Take profit if increases 0,5%
Take loss if decreases 0,25%
Sell when > 1% up
Take profit if decreases 0,5%
Take loss if increases 0,25%
Close position at 08:59 day after, before opening hours
Trade size: 20
I assume you want to use it on a 1-minute TF, don’t you?
1% compared to previous day closing price?
Yes thats right, 1-minute TF.
When the market close 17:30, after that 1% compared with closing price
- For a new topic, your title should be explicit enough to prompt the community to read your discussion.
“code help” is not explicit enough.
@Nicolas: What do you suggest for a title?
The one I wrote in replacement, for example 😉
@alipour , by exemple simple title : suede index market strategy
@nicolas: hahaha yes I saw that. Thanks
@robertogozzi,
Yes thats right, 1-minute TF.
When the market close 17:30, after that 1% compared with closing price
Try this one:
DEFPARAM CumulateOrders = false
TradeOFF = opentime >= 090000 AND opentime <= 173000
ClosingPrice = 0
IF OnMarket AND time = 085900 THEN
SELL AT MARKET
EXITSHORT AT MARKET
ENDIF
IF LongOnMarket THEN
IF (close >= (TradePrice * 1.005)) OR (close <= (TradePrice * 0.975)) THEN
SELL AT MARKET
ENDIF
ELSIF ShortOnMarket THEN
IF (close <= (TradePrice * 0.995)) OR (close >= (TradePrice * 1.025)) THEN
EXITSHORT AT MARKET
ENDIF
ENDIF
IF OpenTime = 173000 THEN
ClosingPrice = close
ENDIF
IF Not OnMarket AND Not TradeOFF THEN
IF close >= (ClosingPrice * 1.01) THEN
BUY 1 CONTRACT AT MARKET
ELSIF close <= (ClosingPrice * 0.99) THEN
SELLSHORT 1 CONTRACT AT MARKET
ENDIF
ENDIF
@alipour , by exemple simple title : suede index market strategy
@swapping Hi, can i get in touch with you private? =)
No private info can be posted.
Any member willing to contact other members can only do this with the help of ADMIN. Contact him first.
@robertogozzi
thank you for your help.
Is it possbile to back track this strategy?
@robertogozzi
In your code, Where does it say wich index to buy?
And if I want to have a trailing stop loss 0,5 instead of regular stop loss, and I want the volume to be low, how can I code that?