Quote Originally Posted by ;
I revised the code replacing orders per your directions above (TS 2000 into TS 8.1). Verifying code required next bar be added so as an illustration Buy 5 Contract tunneltop Cease was altered to Buy 5 Contract next bar tunneltop Stop. The code supports, but nothing plots.

Any help will be appreciated. Below is the revised code:

System title. 1 Hour tunnel - revised for TS 8.1


input:
Decimal(4),
FastMA(144),
SlowMA(169),
NoTradeTime(1701);


var:
tunneltop(0),tunnelBottom(0),
profit55(0),profit89(0),
profit144(0),profit233(0),
profit377(0),profit55s(0),
profit89s(0),profit144s(0),
profit233s(0),profit377s(0),
TradeTime(0);


tunneltop = Maxlist(XAverage(H,SlowMA),XAverage(H,FastMA));
tunnelBottom = Minlist(XAverage(L,SlowMA),XAverage(L,FastMA));

TradeTime = iff(Timegt;NoTradeTime,1,0);

entry conditions
if C lt; tunnelTop And TradeTime=1 then Buy 5 Contract next bar tunneltop Stop;
if C gt; tunnelbottom And TradeTime=1 then Sell 5 Contract next bar tunnelbottom Stop;

exit conditions
If MarketPosition = 1 then
Sell (TTop)next bar tunnelbottom Stop;
If MarketPosition = -1 then
Buy to cover(TBot) next bar tunnelTop Stop;


defying the center of the tunnel and set profit limits with Fib#
if Decimal=2 then profit55 = ((tunnelTop-tunnelbottom)/2) tunnelbottom 0.55;
if Decimal=4 then profit55 = ((tunnelTop-tunnelbottom)/2) tunnelbottom 0.0055;
if Decimal=2 then profit89 = ((tunnelTop-tunnelbottom)/2) tunnelbottom 0.89;
if Decimal=4 then profit89 = ((tunnelTop-tunnelbottom)/2) tunnelbottom 0.0089;
if Decimal=2 then profit144 = ((tunnelTop-tunnelbottom)/2) tunnelbottom 1.44;
if Decimal=4 then profit144 = ((tunnelTop-tunnelbottom)/2) tunnelbottom 0.0144;
if Decimal=2 then profit233 = ((tunnelTop-tunnelbottom)/2) tunnelbottom 2.33;
if Decimal=4 then profit233 = ((tunnelTop-tunnelbottom)/2) tunnelbottom 0.0233;
if Decimal=2 then profit377 = ((tunnelTop-tunnelbottom)/2) tunnelbottom 3.77;
if Decimal=2 then profit377 = ((tunnelTop-tunnelbottom)/2) tunnelbottom 0.0377;
if Decimal=2 then profit55s = ((tunnelTop-tunnelbottom)/2) tunnelbottom - 0.55;
if Decimal=4 then profit55s = ((tunnelTop-tunnelbottom)/2) tunnelbottom - 0.0055;
if Decimal=2 then profit89s = ((tunnelTop-tunnelbottom)/2) tunnelbottom - 0.89;
if Decimal=4 then profit89s = ((tunnelTop-tunnelbottom)/2) tunnelbottom - 0.0089;
if Decimal=2 then profit144s = ((tunnelTop-tunnelbottom)/2) tunnelbottom - 1.44;
if Decimal=4 then profit144s = ((tunnelTop-tunnelbottom)/2) tunnelbottom - 0.0144;
if Decimal=2 then profit233s = ((tunnelTop-tunnelbottom)/2) tunnelbottom - 2.33;
if Decimal=4 then profit233s = ((tunnelTop-tunnelbottom)/2) tunnelbottom - 0.0233;
if Decimal=2 then profit377s = ((tunnelTop-tunnelbottom)/2) tunnelbottom - 3.77;
if Decimal=2 then profit377s = ((tunnelTop-tunnelbottom)/2) tunnelbottom - 0.0377;


********Long Fib profit-taking Exit*************
If MarketPosition = 1 And CurrentContracts = 5 then begin
Sell (Lfib55) 1 Contract next bar at profit55 Limit;
End;
If MarketPosition = 1 And CurrentContracts = 4 then begin
Sell (Lfib89) 1 Contract next bar at profit89 Limit;
End;
If MarketPosition = 1 And CurrentContracts = 3 then begin
Sell (Lfib144) 1 Contract next bar at profit144 Limit;
End;
If MarketPosition = 1 And CurrentContracts = 2 then begin
Sell (Lfib233) 1 Contract next bar at profit233 Limit;
End;
If MarketPosition = 1 And CurrentContracts = 1 then begin
Sell (Lfib377) 1 Contract next bar at profit377 Limit;
End;

*********Short Fib profit-taking Exit*********
If MarketPosition = -1 And CurrentContracts = 5 then begin
Buy to cover (Sfib55) 1 Contract next bar at profit55s Limit;
End;
If MarketPosition = -1 And CurrentContracts = 4 then begin
Buy to cover (Sfib89) 1 Contract next bar at profit89s Limit;
End;
If MarketPosition = -1 And CurrentContracts = 3 then begin
Buy to cover (Sfib144) 1 Contract next bar profit144s Limit;
End;
If MarketPosition = -1 And CurrentContracts = 2 then begin
Buy to cover (Sfib233) 1 Contract next bar profit233s Limit;
End;
If MarketPosition = -1 And CurrentContracts = 1 then begin
Buy to cover (sfib377) 1 Contract next bar profit377s Limit;
End;
DEAR ALL. .
i am new with code in trading. .
I'm using VT how to input those code in VT? Could you clarify me and show me how to utilize to ch the pip profit?
Sory my english is not excellent. .
I'm out USA. .
thanks