Bar + N Limitation In Wealth Lab?
Author: aleehatami
Creation Date: 11/26/2009 4:10 AM
profile picture

aleehatami

#1
Hi guys.

I have been creating script that uses Bar + 2 and I read in the user documentation that for Auto-Trading wealth lab does not support this.

Is this still the case? Is there a way around it?

Also my script uses this to make a limit order:

BuyAtLimit(bar + 2, ma[bar] -.19, "Group1|Group2|")

How do I make it trigger a Market Order when it reaches that price level instead?


I can't just replace it with BuyAtMarket I get this error:

No Overload for method 'BuyAtMarket' takes '3' arguments.

Thanks for any help!
profile picture

Eugene

#2
QUOTE:
Also my script uses this to make a limit order:

BuyAtLimit(bar + 2, ma[bar] -.19, "Group1|Group2|")

First of all, it's not a limitation but a misconception. What exactly are you trying to do with "bar+2"? Buy the day after tomorrow using a price from yesterday? Then you don't need "bar+2": just use BuyAtLimit( bar+1, ma[bar-1]...). Or is it something else?
QUOTE:
I can't just replace it with BuyAtMarket I get this error:

No Overload for method 'BuyAtMarket' takes '3' arguments.

Because the price parameter doesn't make sense to AtMarket order.

profile picture

aleehatami

#3
I'm using a 5 minute chart to Day Trade. Basically, the +2 lets the trend continue for one more bar and most of the time I can get in at a lower price. The difference between that +2 and +1 is about 100% in profit. Is there a way to re-code this without the +2? I'm not good at this.

When you place a buyatmarket + 1 does that mean it will buy at the open of the next bar or will it place a market order immediately within the current bar? I need it to place an order immediately.

Thanks.
profile picture

Eugene

#4
QUOTE:
The difference between that +2 and +1 is about 100% in profit.

Then it may be a short-lived edge, but anyway, there's a way to recode it without the "bar+2":

WealthScript Techniques | Setups, Triggers, Delays, and Timeouts
profile picture

Eugene

#5
QUOTE:
When you place a buyatmarket + 1 does that mean it will buy at the open of the next bar or will it place a market order immediately within the current bar?

Of course at the open of the next bar.
QUOTE:
I need it to place an order immediately.

If you're using any indicator based on the H/L/C prices of the incomplete bar, their readings can change when it closes, invaliding the signal.
profile picture

aleehatami

#6
Ok so you can never get an order filled in between bars? It has to be on the close or on the open? Say the price moved below the moving average and I wanted to execute a market order immediately, I couldn't do that? I'd have to wait for the next bar to open?
profile picture

Eugene

#7
If the price moved below the moving average [e.g. of closing prices] value of the previous bar, you can buy with an AtLimit order [issued after the previous bar completes for bar+1] in between bars.
profile picture

aleehatami

#8
What if an order gets filled only partially at that limit price? I'd rather do Market orders to avoid that problem. Is there anyway to issue a market order when a price reaches a certain level inbetween bars?
profile picture

Cone

#9
QUOTE:
Is there anyway to issue a market order when a price reaches a certain level inbetween bars?
Not for intraday trading (unless you invent something yourself). For EOD trading (and I guess very manually for intraday) you can use the Alerts tool to convert stop and limit orders to market when the trigger price is attained.
profile picture

aleehatami

#10
So there is absolutely no way to trigger a Market Price to execute immediately once your limit price is reached? That's kind of a big feature missing for intra-day traders. I guess WealthLab is geared more towards swing traders?
profile picture

Cone

#11
I didn't and will never say there's absolutely no way to do something with Wealth-Lab, but here's the easy way to solve the problem: Use AtLimit orders and add (buy) or subtract (sell) 1 tick from the limit price. If you do that, you'll be accepting 1 tick slippage (and no more) from your intended price and for all practical purposes guarantee that your order will be filled when the market hits your "intended" price.
profile picture

aleehatami

#12
Hey Cone. What do you think of a BuyAtLimit(bar + 0, Close[bar], "Group1|");

And also setting the "Convert to Market Orders" option, which converts every limit order into a Market order?
profile picture

Eugene

#13
Re: bar+0, please see: Bars, Loops, and Bar + 1 in the Wiki
profile picture

aleehatami

#14
Thanks Eugene. No wonder I thought I was going to make billions ;)
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).