Beginner query regarding order entry price..

Questions about MultiCharts and user contributed studies.
bondstrader
Posts: 7
Joined: 26 Sep 2014
Has thanked: 2 times

Beginner query regarding order entry price..

Postby bondstrader » 30 Sep 2014

Im trying to work through the basics of multicharts, and I tried to chart a moving avg for crude and run a simple order entry signal just to get a feel of the system. But something is amiss. I cannot seem to get the order entry/execution at the price/time I want. Following is a simplified version of what Im trying to do.

Code: Select all

//INDICATOR to chart moving avg based on 3 bar high and low prices.
INPUT :
LENGTH(3), DISPLACE(-1);

Variables:
varDA (0),
varDB (0);

varDA = Average(High, LENGTH); //average * for daily time frame
varDB = Average(Low, LENGTH); ///avg * for weekly frame

IF DISPLACE <= 0 THEN BEGIN

PLOT1[DISPLACE](varDA,"DA");
PLOT2[DISPLACE](varDB,"DB");

END;
And heres the signal.
What I simply want to do in the signal is that when the current ask price is equal to the high average (varDA), I want to put in a limit order at the value of "varDA". However, the signal seems to be all over the place. The trigger price is always several ticks beyond the varDA. Appreciate any help in finding out what Im doing wrong here.

Code: Select all

INPUT :
LENGTH(3), DISPLACE(-1);

Variables:

intrabarpersist varDA (0),
intrabarpersist varDB (0);

varDA = Average(High, LENGTH);
varDB = Average(Low, LENGTH);

[intrabarOrderGeneration = true];

condition1 = CurrentAsk[0] >= varDA[0];

if condition1 then begin

Buy ("Enter Long") 1 Contract Next Bar at varDA[0] Limit;

end;

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Beginner query regarding order entry price..

Postby Henry MultiСharts » 30 Sep 2014

However, the signal seems to be all over the place. The trigger price is always several ticks beyond the varDA.
Hello bondstrader,

Are you referring to backesting/forward testing/realtime broker trading?
Please study the following article: How Signals are Calculated

bondstrader
Posts: 7
Joined: 26 Sep 2014
Has thanked: 2 times

Re: Beginner query regarding order entry price..

Postby bondstrader » 30 Sep 2014

Thanks Henry. That clears up a few things for me, as I was running a backtest.

The kind of results Im hoping for are delivered in Realtime with IOG enabled. Just to confirm, does real time refer to live production trading only, or will it be the same in forward testing on demo accounts as well with real time data?

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Beginner query regarding order entry price..

Postby Henry MultiСharts » 30 Sep 2014

Thanks Henry. That clears up a few things for me, as I was running a backtest.

The kind of results Im hoping for are delivered in Realtime with IOG enabled. Just to confirm, does real time refer to live production trading only, or will it be the same in forward testing on demo accounts as well with real time data?
By Forward Testing I am referring to strategy calculation using realtime data without auto-trading turned on (no connection to broker). The results of forward testing with IOG=On should be similar to Backtesting with Bar Magnifier 1 tick + IOG=On. While turning on the auto trading with a demo broker account should also produce latency, order queue at broker, filling orders at bid/ask prices (it depends on how the broker demo environment is functioning).


Return to “MultiCharts”