Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
I'm using EasyLanguage in ApexTrader and have the following code example:
Inputs: StopAmt(20), ProfitAmt(50), TradeSize(2);
//Buy Order
[IntraBarOrderGeneration=True]
If High > High[1]
and Low > Low[1]
and Low[1] < Low[2]
and Low[2] < Low[3] then
Buy TradeSize Shares next bar at Market;
SetStopContract;
//Stop Loss
SetStopLoss(StopAmt);
//Profit Target
SetProfitTarget(ProfitAmt);
Is there any way to have a buy order execute once the current bar breaks the prior bar's high at the price of the prior bar's high? You can't do Buy this bar at Market.. And at close of this bar is not what I need. Is there maybe a way to say buy this bar at high of prior bar? Or maybe lagging the buy signal?
Thanks!
Tim
Can you help answer these questions from other members on NexusFi?
Buy this bar on close would not work because if the trigger was the break of the prior bar high (entry signal) and "this bar" closes 20 points above the trigger/signal/break of prior bar high, the order does not reflect the actual execution methodology. Basically, I see that a lot of times when I tested this bar on close, the trade was missed and not recording how it should actually be trading.
The prior instructions would be buy this bar on break of prior bar high if signal condition is true.
"Buy this bar on close would not work because if the trigger was the break of the prior bar high (entry signal) and "this bar" closes 20 points above the trigger/signal/break of prior bar high"
In other automated trading system, CLOSE OF THIS BAR should representing the existing real time price. Every new tick from market will form the new CLOSE OF THIS BAR. as soon as it break your trigger, the program should take action to buy/sell.
If it is not working for TS. another work around is use another strategy running on high frequency chart, like 1M to take the instruction from master strategy and open the order on next bar - which will be on min later.
So just to confirm, "Close of this bar" when looking at a 1 hour chart, does not actually mean on the close of the 1 hour signal bar; it means on that bar but at the price on the break of the prior bar's high? My signals plot correctly, but the backtest plots at the actual close of the signal bar.
ApexTrader (which uses tradestation programming) does not let me use exactly what you did above. I referenced the concept into the order though. Below is the code. Also, this chart includes the signals and the order executions from the backtest. I wrote notes on what it's doing and what it should be doing. Any idea how to make this work properly? Thanks!
//FL1 Clean INSIDE bar signal with clean pre bars
if High > High[1]
and Low >= Low[1]
and Low[1] < Low[2]
and High[1] <= High[2]
and Low[2] >= Low[3]
and High[2] >= High[3]
then
Buy next bar at High[1] stop;
SetBreakEven(50);
if Low < Low[1]
then
Sell next bar at Low[1] stop;
SetStopLoss(100);
//FH1 Clean INSIDE bar signal with clean pre bars
if Low < Low[1]
and High <= High[1]
and High[1] > High[2]
and Low[1] >= Low[2]
and High[2] <= High[3]
and Low[2] <= Low[3]
then
SellShort next bar at Low[1] stop;
SetBreakEven(50);
if High > High[1]
then
BuyToCover this bar on close;
SetStopLoss(100);