Quote from Nashequilibrium:
Come on guys....lets not loose perspective, this is a simple question, how do i get the tradestation code to allow me to buy as soon as the cross over occurs....even if it occurs 100 times on that same bar, i don't really care, i just want it to buy/sell as soon as the crossover occurs....thanks!!
input: Price(Close), maLen1(10), maLen2(20), tao(2), UpperTx(1.5), LowerTx(-0.5);
var: ma1(0), ma2(0), maX(0), dv(0), tX(0);
ma1 = average(Price, maLen1);
ma2 = average(Price, maLen2);
dv = (ma1 - ma1[tao])/2 - (ma2 - ma2[tao])/2;
if (AbsValue(dv) > 0) then
tX = (ma2 - ma1)/dv;
if (tx <= UpperTx) and (tx >= -LowerTx) then
plot1(1, "xOver") {crossover expected : buy next bar at open}
else
plot1(0, "xOver") {no crossover expected}
buy this bar on close
if you use
[intrabarorderpersist = true]
then every tick is considered a close price.
Quote from Nashequilibrium:
When I type the "intrabarorderpersist = true" code into my strategy, I get an error message saying that the the program does not recognize the word intrabarorderpersist. Exactly how and where do I type the code to enable intrabar into my strategy?
you must type "[intrabarorderpersist=true]". I would put it as the first line in the strategy.
Quote from Pro_Trader720:
Try this...
Under format strategies, choose format. This is where you modify the inputs. Look for the Calculation tab. You will see the option to enable intrabar orders there. You must use "buy/sell next bar at market" in order for intrabar orders to work.
I still think the code I posted will more accurately produce the signal you are looking for.
Quote from Nashequilibrium:
This is the first option that i tried, but it still doesn't work when i run the strategy, thats why i thought that i needed to do something in the coding.