Stop Order and/or Limit Order at Entry Bar Low
Author: fibonaccitrader
Creation Date: 11/10/2010 3:26 PM
profile picture

fibonaccitrader

#1
I am trying to enter a Limit Order at the Low of the Day of the bar that triggers the trade:
BuyAtLimit(bar, Low[Position.EntryBar], "Group1|");

However, this gives me the error:
CS0120 - "An object reference is required for the non-static field or property WealthLab.Postion.EntryBar.get"

I would also like to enter a Stop Order to exit at the Low of the day minus 1% of the bar that triggered the trade.

Any help much appreciated.
Thanks.
profile picture

Cone

#2
Of course this is worst biggest peeking mistake you can make, but instead of Position.EntryBar (which doesn't exist), use bar.

QUOTE:
Stop Order to exit at the Low of the day minus 1% of the bar that triggered the trade
Since you're peeking, the trigger day is the same as the Position's entry bar. So, in the exit logic...

CODE:
Please log in to see this code.
profile picture

fibonaccitrader

#3
Thanks for reply. Very helpful. What does "worst mistake by peeking mean"?? I'm very new to coding so sorry for basic questions.
Thanks.
profile picture

Eugene

#4
WealthScript Programming Guide (Help menu) > Programming Trading Strategies > Peeking

Peeking | The Dangers of Looking Ahead in Trading System Development
Introductory | Bars, Loops, and Bar + 1

Hope this helps.
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).