Los Angeles, CA
Experience: Advanced
Platform: Tradestation
Broker: Tradestation
Trading: ES,HG,GC,YM,Nq,RB,NG
Posts: 52 since Aug 2011
Thanks Given: 11
Thanks Received: 8
|
I have a modified example code below for multicharts which works fine for me but is a probelm for the exchanges which i need to resolve. When market is open and my conidion is met then it will get me into a position and at the same time put a stoploss and targetprofit. Once the market closes my setstoploss and setprofittarget keep firing to the exchange and gets rejected over and over (500 times or more) until the market reopens and then it will put my stoploss and targetprofit which is correct and fine by me. However the exchanges dont like me to keep sending in the setstoploss and target profit orders over and over since its getting rejected during the market close time. How would i adjust the code so it wont do that but it will do it once the market is open so my intial position isnt exposed?
inputspp(500), lll(500);
if marketposition = 0 and h>h[1] then
buy 1 contracts next bar at h stop;
if marketposition = 0 and l<l[1] then
sellshort 1 contracts next bar at l stop;
setstopcontract;
setprofittarget(ppp);
setstoploss(lll);
|