Howdy all!
I have coded a simple trend system, consisting of a long term moving average element with a breakout element based on weekly end-of-day data, and a "close of data1/close of data2" chart showing the trade executions on the daily data.
But I have hit a sticky point. The system executes a "coverBuy" or "coverSell" based on a pullback or rally of N-weeks. In reviewing the trades, I have found that the price reversed and closed at an N-week HIGH or LOW after the covering trades, and began a new, strong trend before the long term system signaled another entry.
I cannot figure out how to incorporate the N-week "price-reversal-after-the-cover-trade" signal.
Any and all guidance and opinions are appreciated in advance.
virginiatrader
Tie one system to another
- virginiatrader
- Posts: 79
- Joined: 05 May 2007
- Location: Virginia
- Has thanked: 5 times
- Been thanked: 5 times
Tie one system to another
- Attachments
-
- Cotton with Buys and coverBuy.png
- (49.39 KiB) Downloaded 365 times
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: Tie one system to another
not sure what you are trying to achieve.Howdy all!
I have coded a simple trend system, consisting of a long term moving average element with a breakout element based on weekly end-of-day data, and a "close of data1/close of data2" chart showing the trade executions on the daily data.
But I have hit a sticky point. The system executes a "coverBuy" or "coverSell" based on a pullback or rally of N-weeks. In reviewing the trades, I have found that the price reversed and closed at an N-week HIGH or LOW after the covering trades, and began a new, strong trend before the long term system signaled another entry.
I cannot figure out how to incorporate the N-week "price-reversal-after-the-cover-trade" signal.
Any and all guidance and opinions are appreciated in advance.
virginiatrader
can you post your codes?
you really should start with a flow-chart... with step-by-step instruction clearly described at each branch.
- virginiatrader
- Posts: 79
- Joined: 05 May 2007
- Location: Virginia
- Has thanked: 5 times
- Been thanked: 5 times
Re: Tie one system to another
As requested:
[IntrabarOrderGeneration = true]
inputs: lengthTrendAvg(52), lengthBreakout(13), lengthClose(4);
{***************************************************************************************}
if xaverage(close of data2,lengthTrendAvg) > xaverage(close of data2,lengthTrendAvg) [1]
then begin
if close of data2 > highest(high of data2,lengthBreakout) [1]
then buy ("CS4LE") 1 contracts next bar at Open;
end;
{***************************************************************************************}
if close of data2 < lowest(close of data2,lengthClose) [1]
and close > open
then sell ("coverBuy") next bar at Open;
{***************************************************************************************}
if xaverage(close of data2,lengthTrendAvg) < xaverage(close of data2,lengthTrendAvg) [1]
then begin
if close of data2 < lowest(low of data2,lengthBreakout) [1]
then sellshort ("CS4SE") 1 contracts next bar at Open;
end;
{***************************************************************************************}
if close of data2 > highest(close of data2,lengthClose) [1]
and close < open
then buytocover ("coverSell") next bar at Open;
{***************************************************************************************}
Will give the flowchart a try!
[IntrabarOrderGeneration = true]
inputs: lengthTrendAvg(52), lengthBreakout(13), lengthClose(4);
{***************************************************************************************}
if xaverage(close of data2,lengthTrendAvg) > xaverage(close of data2,lengthTrendAvg) [1]
then begin
if close of data2 > highest(high of data2,lengthBreakout) [1]
then buy ("CS4LE") 1 contracts next bar at Open;
end;
{***************************************************************************************}
if close of data2 < lowest(close of data2,lengthClose) [1]
and close > open
then sell ("coverBuy") next bar at Open;
{***************************************************************************************}
if xaverage(close of data2,lengthTrendAvg) < xaverage(close of data2,lengthTrendAvg) [1]
then begin
if close of data2 < lowest(low of data2,lengthBreakout) [1]
then sellshort ("CS4SE") 1 contracts next bar at Open;
end;
{***************************************************************************************}
if close of data2 > highest(close of data2,lengthClose) [1]
and close < open
then buytocover ("coverSell") next bar at Open;
{***************************************************************************************}
Will give the flowchart a try!
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: Tie one system to another
please use code tag when posting codes. It makes reading codes easier.
I have added the tags for you below:
I have added the tags for you below:
Code: Select all
[IntrabarOrderGeneration = true]
inputs: lengthTrendAvg(52), lengthBreakout(13), lengthClose(4);
{***************************************************************************************}
if xaverage(close of data2,lengthTrendAvg) > xaverage(close of data2,lengthTrendAvg) [1]
then begin
if close of data2 > highest(high of data2,lengthBreakout) [1]
then buy ("CS4LE") 1 contracts next bar at Open;
end;
{***************************************************************************************}
if close of data2 < lowest(close of data2,lengthClose) [1]
and close > open
then sell ("coverBuy") next bar at Open;
{***************************************************************************************}
if xaverage(close of data2,lengthTrendAvg) < xaverage(close of data2,lengthTrendAvg) [1]
then begin
if close of data2 < lowest(low of data2,lengthBreakout) [1]
then sellshort ("CS4SE") 1 contracts next bar at Open;
end;
{***************************************************************************************}
if close of data2 > highest(close of data2,lengthClose) [1]
and close < open
then buytocover ("coverSell") next bar at Open;
{***************************************************************************************}
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: Tie one system to another
p.s.
should be written as
viewtopic.php?f=16&t=6929
Code: Select all
xaverage(close of data2,lengthTrendAvg)
see post #5xaverage(close, lengthTrendAvg) of data2
viewtopic.php?f=16&t=6929
- virginiatrader
- Posts: 79
- Joined: 05 May 2007
- Location: Virginia
- Has thanked: 5 times
- Been thanked: 5 times
Re: Tie one system to another
Thanks, sir. The modification you recommended changes the results of the Performance Summary slightly. Also, thanks for the heads-up about the code tags...didn't know.
Still working on the flow chart. I can see what I want to accomplish in my head, just not sure how to code it.
virginiatrader
Still working on the flow chart. I can see what I want to accomplish in my head, just not sure how to code it.
virginiatrader