taotrader
Sep 10 2004, 03:18 AM
Hi Chris,
I think you were the one who coded the bi-color MA, which is a nice feature. Thanks. However, I was wondering why there are blank gaps every so often in the display of the MA. First, I thought it's because the price equals the MA, but that's not it. I can't seem to figure it out how to close those gaps. Any ideas?
Thanks,
Gernot
cskidmore
Sep 10 2004, 04:46 PM
Hello Gernot,
I looked at that myself while I was coding it. I think the gaps are caused by the transition between the 2 MA's. Basically, the indicator is 2 MA's ... one for UP and one for DOWN; the display switches depending on where price is in relation. The gaps are the space between the candles when the indicator switches MA's.
I do not know of a way to fill the gaps between candles in this particular instance. What you could do, however, is switch the line style to that of dots so it would look just like the PSAR indicator when it switches.
I'll let you know if I come up with a more graceful solution.
Regards,
Chris
taotrader
Sep 11 2004, 07:23 PM
Hi Chris,
I've found a solution to the gaps. Here is your formula:
MA:=mov(pr1,per1,mt1);
MA_UP:=if(pr>MA,MA,null);
MA_DOWN:=if(MA>pr,MA,null);
Instead of outputting only MA_UP and MA_DOWN you add the MA variable of the first line to the output. Make sure that in the output menu MA comes first. Select the same for the MA color as one of the other two. It also helps to chose a thicker line width. That should do it.
Regards,
Gernot
cskidmore
Sep 11 2004, 09:20 PM
Hello,
Yep, that fixed it. Thanks! I thought I had tried that, but what I didn't do was put the first MA output at the top of the output list.
Regards,
Chris
jonbowler
Sep 23 2004, 07:37 PM
Where can I download the Bi-Color MA Indicator?
cskidmore
Sep 24 2004, 02:25 AM
Hello,
I've attached it to this post for you. Download the .vtscr file and import it into VT using the Indicator Builder. Enjoy.
Regards,
Chris
aardd
Aug 16 2006, 06:45 AM
Greetings from New Zealand.
I have down loaded the bicolor moving average to my desktop,,but being tech green, I am wondering if anyone has the time or the inclination to explain step by step the method from post to chart.
Thanks for your time.
aardd
cskidmore
Aug 16 2006, 11:48 AM
Hello,
aardd: Please review the following FAQ:
http://forum.vtsystems.com/index.php?showtopic=19Thank you.
Regards,
Chris
aardd
Aug 16 2006, 03:59 PM
Hi Chris
Exellent,you are a champion, Thankyou.
Kind Regards
aard
cskidmore
Aug 16 2006, 05:10 PM
Hello,
aard: You're welcome.
Regards,
Chris
aardd
Nov 25 2007, 02:59 AM
QUOTE(cskidmore @ Aug 17 2006, 11:10 AM)

Hello,
aard: You're welcome.
Regards,
Chris
Hi Chris
With your bi-color MA is it possible to have a visual or audio alert when the up or down color changes??
Thanks
aard
cskidmore
Nov 25 2007, 09:43 AM
Hello,
No, alerts need to be programmed into a simple trading system. However, the code for such is very simple. It would look like the following:
MA:= mov(C,13,S); {13-period MA of close price}
MaUp:= if(MA>=ref(MA,-1),MA,null); {up-part of bi-color MA}
MaDown:= if(MA<ref(MA,-1)MA,null); {down-part of bi-color MA}
MaUpSignal:= Cross((MA>=ref(MA,-1)),0.5); {signal transition from down to up}
MaDownSignal:= Cross((MA<ref(MA,-1)),0.5); {signal transition from up to down}
MaUpSignal and MaDownSignal would be the "Alert Enabled" and "Graphic Enabled" output variables. MaUp and MaDown would be the "Indicator Output Enabled" variables if you wanted to display the bi-color MA as part of the trading system. You could also create 3 inputs for the price, periods, and MA Type parameters of the MA variable if you wanted to.
Lastly, it's very likely that such a system already exists. I recommend that you thoroughly search the forums to see if you can find it.
Regards,
Chris
aardd
Nov 25 2007, 02:52 PM
QUOTE(cskidmore @ Nov 26 2007, 03:43 AM)

Hello,
No, alerts need to be programmed into a simple trading system. However, the code for such is very simple. It would look like the following:
MA:= mov(C,13,S); {13-period MA of close price}
MaUp:= if(MA>=ref(MA,-1),MA,null); {up-part of bi-color MA}
MaDown:= if(MA<ref(MA,-1)MA,null); {down-part of bi-color MA}
MaUpSignal:= Cross((MA>=ref(MA,-1)),0.5); {signal transition from down to up}
MaDownSignal:= Cross((MA<ref(MA,-1)),0.5); {signal transition from up to down}
MaUpSignal and MaDownSignal would be the "Alert Enabled" and "Graphic Enabled" output variables. MaUp and MaDown would be the "Indicator Output Enabled" variables if you wanted to display the bi-color MA as part of the trading system. You could also create 3 inputs for the price, periods, and MA Type parameters of the MA variable if you wanted to.
Lastly, it's very likely that such a system already exists. I recommend that you thoroughly search the forums to see if you can find it.
Regards,
Chris
Thankyou fpr your prompt reply,I have been looking -but must have missed it.
Have a great day
aard
cskidmore
Nov 25 2007, 05:53 PM
Hello,
You're welcome. In case you can't find it, the code I supplied can be used to create yourself a custom alert-only trading system that will do what you require. I recommend taking a few minutes to read through the Indicator Builder, Indicator Builder Step by Step, and Trading Systems Builder section of the help manual. I think you'll find that creating the system yourself won't be as difficult as it might seem at first, especially since I've already supplied the necessary code. Building the system should almost be point-and-click.
Regards,
Chris
domi
Nov 29 2007, 07:05 AM
Bonjour Chris,
I would like attach a system with a MA bicolor, buy or sell when the MA bicolor change.
Also I wrote : Long:= MA>ref (MA,-1) but I have continualy buy,buy, buy as each bar.
I think I must write:
Long := MA> ref(MA,-1) and (MA,-1)<(MA,-2) but this is error.
Can you help for this.
Thank you very much for your answer
cskidmore
Nov 29 2007, 09:46 AM
Hello,
QUOTE
I would like attach a system with a MA bicolor, buy or sell when the MA bicolor change.
Also I wrote : Long:= MA>ref (MA,-1) but I have continualy buy,buy, buy as each bar.
I think I must write:
Long := MA> ref(MA,-1) and (MA,-1)<(MA,-2) but this is error.
Please review the code in the previous post #12 in this topic:
http://forum.vtsystems.com/index.php?s=&am...ost&p=33062The MaUpSignal and MaDownSignal is the code you require.
Regards,
Chris
domi
Nov 29 2007, 11:26 AM
re-Bonjour,
Excuse me maybe I have no explain but it's no the same problem. The code write post #12 in this topic ,I have already the MAUpSignal and the MADownSignal .
Now I would like write in my system Long := (when change Down to Up) MA>ref(MA,-1) and(MA,-1)<(MA,-2) but this is an error because I cannot download the formula and if I not ajout that , there is buy signal on each bar.
Thank for your answer.
cskidmore
Nov 29 2007, 11:47 AM
Hello,
Yes, it is the same problem. You do not understand what the code does. What those MaUpSignal and MaDownSignal variables do is identify the first bar when the MA changes color, both up and down. This is exactly what you're trying to accomplish. The MaUpSignal would be the equivalent of your "long" and vice versa for the MaDownSignal being the equivalent of "short".
However, if you're set on using your code instead, you need to change it so that you have the proper format:
Long := MA>ref(MA,-1) and ref(MA,-1)<ref(MA,-2);
Regards,
Chris
tnuolb41
Nov 29 2007, 12:21 PM
QUOTE(cskidmore @ Nov 25 2007, 05:53 PM)

Hello,
You're welcome. In case you can't find it, the code I supplied can be used to create yourself a custom alert-only trading system that will do what you require. I recommend taking a few minutes to read through the Indicator Builder, Indicator Builder Step by Step, and Trading Systems Builder section of the help manual. I think you'll find that creating the system yourself won't be as difficult as it might seem at first, especially since I've already supplied the necessary code. Building the system should almost be point-and-click.
Regards,
Chris
cs kidmore im new to vt trading so if your allowed to rate or give your expert opinion on the best auto trading systems on this forum please do so, the one's that work consistently good. i've been looking into the level stop reverse. is this a good system? also is a system only as good as the parameters you set in the (system parameters) window, i can never seem to get those parameters just perfect, is there a secret to it?
greg: confussed trader
domi
Nov 29 2007, 12:30 PM
Bonjour,
It's ok now with your code. Again thank you very much.
cskidmore
Nov 29 2007, 01:52 PM
Hello,
You're welcome. I'm glad the code worked for you. In regards to making recommendations re: trading systems, I cannot.
Regards,
Chris
aardd
Nov 30 2007, 12:28 AM
QUOTE(cskidmore @ Nov 26 2007, 11:53 AM)

Hello,
You're welcome. In case you can't find it, the code I supplied can be used to create yourself a custom alert-only trading system that will do what you require. I recommend taking a few minutes to read through the Indicator Builder, Indicator Builder Step by Step, and Trading Systems Builder section of the help manual. I think you'll find that creating the system yourself won't be as difficult as it might seem at first, especially since I've already supplied the necessary code. Building the system should almost be point-and-click.
Regards,
Chris
Hi Chris,,I have two problems here--1 I cannot find any relevant posts regarding the alert in question,2 I am completly out of my depth, lost ,clueless with coding and the placement there of,however I can follow instuctions,after 53yrs you would hope so I guess.
Never the less I thankyou for your time,help, and code.
Regards
aard
TraderR
May 23 2010, 07:09 PM
Hello Chris:
I downloaded the bicolor MA indicator. As I understand, it changes color if the Price closes above or below MA.
However, I wanted to modify it to display color change when MA of today turned up or down from yesterday. So for example, if MA continues to go up, it will be one colour, and when it turns down the colour changes.
I tried the following code:
MA:=mov(C,9,S);
MA_UP:= if(MA>Ref(MA,-1),MA,null);
MA_DOWN:= if(MA<Ref(MA,-1),MA,null);
MA_Same:= if(MA=Ref(MA,-1),MA,null)
I then plot MA,MA_UP, MA_DOWN and MA_SAME.
However I get the following error message:
"Unknown error in Process Script"
Can you please help?
Thanks
QUOTE(cskidmore @ Nov 25 2007, 10:43 PM)

Hello,
No, alerts need to be programmed into a simple trading system. However, the code for such is very simple. It would look like the following:
MA:= mov(C,13,S); {13-period MA of close price}
MaUp:= if(MA>=ref(MA,-1),MA,null); {up-part of bi-color MA}
MaDown:= if(MA<ref(MA,-1)MA,null); {down-part of bi-color MA}
MaUpSignal:= Cross((MA>=ref(MA,-1)),0.5); {signal transition from down to up}
MaDownSignal:= Cross((MA<ref(MA,-1)),0.5); {signal transition from up to down}
MaUpSignal and MaDownSignal would be the "Alert Enabled" and "Graphic Enabled" output variables. MaUp and MaDown would be the "Indicator Output Enabled" variables if you wanted to display the bi-color MA as part of the trading system. You could also create 3 inputs for the price, periods, and MA Type parameters of the MA variable if you wanted to.
Lastly, it's very likely that such a system already exists. I recommend that you thoroughly search the forums to see if you can find it.
Regards,
Chris
cskidmore
May 23 2010, 08:04 PM
Hello,
QUOTE
I downloaded the bicolor MA indicator. As I understand, it changes color if the Price closes above or below MA.
That's not correct. It works exactly like you want it to already. It changes color when the current MA value is > or < the previous MA value.
Regards,
Chris
TraderR
May 24 2010, 07:38 PM
Chris:
I am talking about the following indicator. I am also attaching screenshot of what I see... What am I doing wrong?
Thanks
Rahul
==
Hello,
I've attached it to this post for you. Download the .vtscr file and import it into VT using the Indicator Builder. Enjoy.
Regards,
Chris
Attached File(s)
Attached File bicolor_moving_average.vtscr ( 885bytes ) Number of downloads: 3250
==
QUOTE(cskidmore @ May 24 2010, 09:04 AM)

Hello,
That's not correct. It works exactly like you want it to already. It changes color when the current MA value is > or < the previous MA value.
Regards,
Chris
cskidmore
May 24 2010, 08:06 PM
Hello,
I apologize, but I'm confused. The indicator you've referenced colors the moving average as follows:
MA:= mov(C,13,S); {13-period MA of close price}
MaUp:= if(MA>=ref(MA,-1),MA,null); {up-part of bi-color MA}
MaDown:= if(MA<ref(MA,-1),MA,null); {down-part of bi-color MA}
That states, MaUp = current MA values is >= previous MA value and MaDown = current MA value is < previous MA value.
This is what you mentioned you wanted. See your quote:
QUOTE
However, I wanted to modify it to display color change when MA of today turned up or down from yesterday.
If the code was basing the MA color on its relationship to the close price, the code would look like this:
MA:= mov(C,13,S); {13-period MA of close price}
MaUp:= if(MA>=C,MA,null); {up-part of bi-color MA}
MaDown:= if(MA<C,MA,null); {down-part of bi-color MA}
That states, MaUp = current MA values is >= current close price and MaDown = current MA value is < current close price.
Would you please attach the actual file (either .vtscr or .vttrs) that you are working with so I can look at its actual code. Thank you.
Regards,
Chris
TraderR
May 25 2010, 08:40 AM
Chris
Sorry for confusing you.
1) I first downloaded the attached file from your post dated Sep 24 2004, 03:25 PM. I have attached this file.
Click to view attachment (bicolor_moving_average_Chris.vtscr)
My original question was pertaining to this attachment. In this attachment, the MA colour changes when price closes above or below the MA.
2) I then modefied it to the following to test the code. The attached file has my code.
Click to view attachment (bicolor_moving_average_RM.vtscr)
However when I save this file, I get error.
I want the MA to behave exactly as you have described
That states, MaUp = current MA values is >= previous MA value and MaDown = current MA value is < previous MA value.
Thanks for your help.
QUOTE(cskidmore @ May 25 2010, 09:06 AM)

Hello,
I apologize, but I'm confused. The indicator you've referenced colors the moving average as follows:
MA:= mov(C,13,S); {13-period MA of close price}
MaUp:= if(MA>=ref(MA,-1),MA,null); {up-part of bi-color MA}
MaDown:= if(MA<ref(MA,-1),MA,null); {down-part of bi-color MA}
That states, MaUp = current MA values is >= previous MA value and MaDown = current MA value is < previous MA value.
This is what you mentioned you wanted. See your quote:
If the code was basing the MA color on its relationship to the close price, the code would look like this:
MA:= mov(C,13,S); {13-period MA of close price}
MaUp:= if(MA>=C,MA,null); {up-part of bi-color MA}
MaDown:= if(MA<C,MA,null); {down-part of bi-color MA}
That states, MaUp = current MA values is >= current close price and MaDown = current MA value is < current close price.
Would you please attach the actual file (either .vtscr or .vttrs) that you are working with so I can look at its actual code. Thank you.
Regards,
Chris
cskidmore
May 25 2010, 09:07 AM
Thank you. That makes it much more clear. There's a missing comma in your last line of code. This one:
MaDown:= if(MA<ref(MA,-1)MA,null);
It should be:
MaDown:= if(MA<ref(MA,-1),MA,null);
... notice the , directly before the MA,null); portion; that was a typo in my original code in this topic I think.
Regards,
Chris
TraderR
May 25 2010, 11:17 AM
Thanks Chris. This works now.
QUOTE(cskidmore @ May 25 2010, 10:07 PM)

Thank you. That makes it much more clear. There's a missing comma in your last line of code. This one:
MaDown:= if(MA<ref(MA,-1)MA,null);
It should be:
MaDown:= if(MA<ref(MA,-1),MA,null);
... notice the , directly before the MA,null); portion; that was a typo in my original code in this topic I think.
Regards,
Chris
TraderR
May 25 2010, 11:21 AM
Chris
Another question:
In your code below, what does 0.5 signify in the Cross function?
Thanks
QUOTE(cskidmore @ Nov 25 2007, 10:43 PM)

Hello,
No, alerts need to be programmed into a simple trading system. However, the code for such is very simple. It would look like the following:
MA:= mov(C,13,S); {13-period MA of close price}
MaUp:= if(MA>=ref(MA,-1),MA,null); {up-part of bi-color MA}
MaDown:= if(MA<ref(MA,-1)MA,null); {down-part of bi-color MA}
MaUpSignal:= Cross((MA>=ref(MA,-1)),0.5); {signal transition from down to up}
MaDownSignal:= Cross((MA<ref(MA,-1)),0.5); {signal transition from up to down}
MaUpSignal and MaDownSignal would be the "Alert Enabled" and "Graphic Enabled" output variables. MaUp and MaDown would be the "Indicator Output Enabled" variables if you wanted to display the bi-color MA as part of the trading system. You could also create 3 inputs for the price, periods, and MA Type parameters of the MA variable if you wanted to.
Lastly, it's very likely that such a system already exists. I recommend that you thoroughly search the forums to see if you can find it.
Regards,
Chris
cskidmore
May 25 2010, 04:52 PM
Hello,
The cross() function lets us identify only the first bar when the current value of MA > or < the previous value of MA. Without the cross() function in that code you would get a signal for every bar when the MA > or < previous value of MA instead of only the first bar. We could have chosen any value between 0 and 1 since the cross() function evaluates the condition to either false (0) or true (1). For more information you may want to review the cross()'s function's page in VT Trader's help manual.
Regards,
Chris
QUOTE(TraderR @ May 25 2010, 12:21 PM)

Chris
Another question:
In your code below, what does 0.5 signify in the Cross function?
Thanks
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.