I've been trying to create a signal that:
1. buy when price crosses over VWAP
2. sell short when price crosses under VWAP
so far this is the code:
input:
Price(AvgPrice),
LocalHrsOffset(0),
time1(0900),
time2(0930),
time3(1129),
time4(1315),
time5(1415),
upColor(Cyan),
dnColor(Magenta);
var:
var0(0);
var0 = VWAPResettable(Price,LocalHrsOffset,time1,time2,time3,time4,time5);
plot1(var0,"vwap_reset");
var: var1(yellow);
if var0 > var0[1] then var1 = upColor;
if var0 < var0[1] then var1 = dnColor;
SetPlotColor(1,var1);
if price crosses over vwapResettable then buy this bar ;
if price crosses under vwapResettable then sellshort this bar ;
but after trying to compile the signal it shows this message and I cant figure out wheres the error (im new to multicharts):
------ Compiled with error(s): ------
Invalid number of parameters. 7 parameter(s) expected
line 23, column 22
can someone can help me to create this signal??
thanks!!
need help with VWAP cross over signal
-
- Posts: 33
- Joined: 12 Mar 2015
- Has thanked: 4 times
- TJ
- Posts: 7742
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: need help with VWAP cross over signal
Please read the error message carefully...I've been trying to create a signal that:
1. buy when price crosses over VWAP
2. sell short when price crosses under VWAP
so far this is the code:
input:
Price(AvgPrice),
LocalHrsOffset(0),
time1(0900),
time2(0930),
time3(1129),
time4(1315),
time5(1415),
upColor(Cyan),
dnColor(Magenta);
var:
var0(0);
var0 = VWAPResettable(Price,LocalHrsOffset,time1,time2,time3,time4,time5);
plot1(var0,"vwap_reset");
var: var1(yellow);
if var0 > var0[1] then var1 = upColor;
if var0 < var0[1] then var1 = dnColor;
SetPlotColor(1,var1);
if price crosses over vwapResettable then buy this bar ;
if price crosses under vwapResettable then sellshort this bar ;
but after trying to compile the signal it shows this message and I cant figure out wheres the error (im new to multicharts):
------ Compiled with error(s): ------
Invalid number of parameters. 7 parameter(s) expected
line 23, column 22
can someone can help me to create this signal??
thanks!!
line 23, column 22: 7 parameter(s) expected
- TJ
- Posts: 7742
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
- TJ
- Posts: 7742
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: need help with VWAP cross over signal
If you are new to programming or MultiCharts,
please go to PowerLanguage Editor and open one of the 150+ signals that came with MultiCharts.
There are lots examples you can explore, test, and codes to borrow.
please go to PowerLanguage Editor and open one of the 150+ signals that came with MultiCharts.
There are lots examples you can explore, test, and codes to borrow.
-
- Posts: 196
- Joined: 08 Aug 2012
- Has thanked: 41 times
- Been thanked: 41 times
Re: need help with VWAP cross over signal
check to see if the plot part of the code is causing the problem.
I remember something about not being able to use plot commands in a signal.
shane
I remember something about not being able to use plot commands in a signal.
shane
-
- Posts: 33
- Joined: 12 Mar 2015
- Has thanked: 4 times
Re: need help with VWAP cross over signal
ok, I tried to create the code based on the moving average cross signal and this is what I got, but still cant get it right:
Code: Select all
input:
Price(AvgPrice),
LocalHrsOffset(0),
time1(0900),
time2(0930),
time3(1129),
time4(1315),
time5(1415),
upColor(Cyan),
dnColor(Magenta);
var:
var0(0);
var0 = VWAPResettable(Price,LocalHrsOffset,time1,time2,time3,time4,time5);
plot1(var0,"vwap_reset");
var: var1(yellow);
if var0 > var0[1] then var1 = upColor;
if var0 < var0[1] then var1 = dnColor;
SetPlotColor(1,var1);
condition1 = Price > "vwap_Reset" ;
if condition1 then
var0 = var0 + 1
else
var0 = 0 ;
condition1 = CurrentBar > ConfirmBars and var0 = ConfirmBars ;
if condition1 then
Buy ( "vwap_reset" ) next bar at limit ;
- TJ
- Posts: 7742
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: need help with VWAP cross over signal
See post #5ok, I tried to create the code based on the moving average cross signal and this is what I got, but still cant get it right:
::
You cannot have PLOT in a signal.
- TJ
- Posts: 7742
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: need help with VWAP cross over signal
You have multiple coding errors in your signal.
Please read post #4 again.
This is a good place to start:
viewtopic.php?f=16&t=6929
Please read post #4 again.
This is a good place to start:
viewtopic.php?f=16&t=6929