PDA

View Full Version : Using Record Trades as an indicator


Stevo
20th July 2003, 10:03 AM
This seems like quite a useful thing to do and could save quite a bit of coding. I can just copy and past the TradeSim explorer to an indicator, make a few minor adjustments and then use the indicator in explorers and experts.

What I am having trouble with is that the last bar always appears to have an exit triggered. Is there any way around this so I can use Record Trades in an expert, indicator or explorer?

thanks
Steve

Stevo
24th July 2003, 10:02 PM
Maybe my question was not all that clear so I will try to rephrase it. I tried to use something like the following code as an indicator on charts to show buy and sell signals.


{===Stop===}
stop:=fml("Exit signal");
{===Smoothed Roc Entry setup===}
sig:=fml("Buy signal");
{==============================}
EntryTrigger:=Cross(sig,0.5);
ExitTrigger:=close<Ref(stop,-1);
InitialStop:=C-ATR(5);
EntryPrice:=CLOSE;
ExitPrice:=CLOSE;

dummy:=ExtFml("TradeSim.Initialize");
dummy:=ExtFml( "TradeSim.SetProfitStop",75);
dummy:=ExtFml("TradeSim.SuppressFileProcessing");
dummy:=ExtFml("TradeSim.SetReturnInfoType",AllTriggers);

ExtFml("TradeSim.RecordTrades",
"indicator only",
LONG,
EntryTrigger,
EntryPrice,
InitialStop,
ExitTrigger,
ExitPrice,
START);

When a trade is underway the last bar on the chart will always show an exit signal. Is there any way around this?

Steve

David Samborsky
25th July 2003, 02:16 AM
Hello Steve

The last bar will have an exit trigger if there is a valid exit at that point or the RecordTrades function attempts to close out an open trade which hasn't previously been terminated using a valid exit.