• Home
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • User/Email: Password:
  • 10:15am
Menu
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • 10:15am
Sister Sites
  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Options

Bookmark Thread

First Page First Unread Last Page Last Post

Printable Version

Similar Threads

Syntax Help Needed 7 replies

Syntax Help 10 replies

1h & 4h DDE Syntax for OpenOffice Calculator 0 replies

which syntax that check open order? 7 replies

jurik syntax question 1 reply

  • Trading Discussion
  • /
  • Reply to Thread
  • Subscribe

VT Dumb Syntax Questions

  • Post #1
  • Quote
  • First Post: Jun 22, 2006 5:06am Jun 22, 2006 5:06am
  •  pmurfin
  • | Joined Apr 2006 | Status: I'll be back | 87 Posts
Hi

A few dumb questions from a newbe ... bear with me!

1. how do i construct this in the VT language?

if ( x > y and a < b) then
output_variable = 1;
else if ( x < y and a < b) then
output_variable = -1;
else
output_variable = 0;
endif

2) then if the output_variable is 1 paint a buy arrow on the chart below the bar , if the output_variable is -1 paint a sell arrow in the chart above the bar and if the output_variable is 0 paint nothing.

3) can I refer to custom indicators in code?

4) how in code do i determine the current time period?

5) can i calculate a moving average in custom indicator code for a different time frame than the chart is in ... e.g. in a custome indicator designed for a 30 minute chart can i calculate a daily moving average?


THANKS !!!!!!!


Paul
  • Post #2
  • Quote
  • Jun 22, 2006 10:10am Jun 22, 2006 10:10am
  •  Bemac
  • Joined Jan 2006 | Status: Monarch o' the Glen | 5,561 Posts
Hey Paul,

Judging by the time you posted this, it looks like you are in a different timzone than I am. So I thought I would post this before you log off.

I have to run to a meeting right now and will post code etc later but meanwhile...

Yes to both. although the higher timeframe ma is not exact.

A 14 bar MA on a 30 min Chart would be "Similar" to a 7 Bar MA on a 1 Hour Chart.
  • Post #3
  • Quote
  • Edited at 1:29pm Jun 22, 2006 1:24pm | Edited at 1:29pm
  •  Bemac
  • Joined Jan 2006 | Status: Monarch o' the Glen | 5,561 Posts
Quoting pmurfin
Disliked
Hi

A few dumb questions from a newbe ... bear with me!

1. how do i construct this in the VT language?

if ( x > y and a < b) then
output_variable = 1;
else if ( x < y and a < b) then
output_variable = -1;
else
output_variable = 0;
endif

2) then if the output_variable is 1 paint a buy arrow on the chart below the bar , if the output_variable is -1 paint a sell arrow in the chart above the bar and if the output_variable is 0 paint nothing.

3) can I refer to custom indicators in code?

4) how in code do i determine the current time period?

5) can i calculate a moving average in custom indicator code for a different time frame than the chart is in ... e.g. in a custome indicator designed for a 30 minute chart can i calculate a daily moving average?


THANKS !!!!!!!


Paul
Ignored
Firstly, you would have to do it in a Strategy, not an indicator.

1)
MyVariable:=IF( x > y and a < b, 1, If( x < y and a < b ,-1, 0));

The value of "MyVariable" will be either 1, -1 or 0.

2)
BuySetup:=MyVariable= 1;
SellSetup:=MyVariable= -1;
OR, depending on the result you want, you may need to write it this way.
BuySetup:=Cross(MyVariable,0.5);
SellSetup:=Cross(-0.5,MyVariable);
The latter will result being True Only When it happens and not While it Continues to be True.

Define BuySetup & SellSetup as Outputs and Checkmark beside Graphic.
Select the Graphic Tab and add the arrow above/below, colour & size.

3)Yes. But ony one Output of that indicator. I find it simpler in most cases just to add the indicator code itself in entirity.

4) I actually posted a snippet for exactly that a couple of days ago.
"See Auto Timeframe Snippet" thread here.

5) Yes and you can make it as simple or complicated as you like.
Simple: Do the math. MA Period*(Desired Timeframe/Actual Timeframe)
ie. 4 hour{240 min} 21 bar MA plotted on a 30 Minute Chart.
21*(240/30)= 168. {I know I don't need the brackets, it's just a visual aid for me}
This will Not be Exact becase the average of 168 closes on a 30 minute Chart may not be the same as the average of 21 closes on a 240 minute Chart. But it will be very close.

Complicated: requires a bit of code to do basically the same thing but can have Input options to make it more user friendly like Chosing a timeframe to pull the MA from and how many Periods you want it based on.

I have one lying around here somewhere. I'll post it in the New section.
  • Post #4
  • Quote
  • Jun 22, 2006 3:44pm Jun 22, 2006 3:44pm
  •  pmurfin
  • | Joined Apr 2006 | Status: I'll be back | 87 Posts
Bemac

Thanks so much ... This website is amazing because of the help offered by those who know to those who do not ... it is great to be welcomed into the community ...

Very very much appreciated

Paul
  • Post #5
  • Quote
  • Last Post: Jun 22, 2006 4:58pm Jun 22, 2006 4:58pm
  •  Bemac
  • Joined Jan 2006 | Status: Monarch o' the Glen | 5,561 Posts
Quoting pmurfin
Disliked
Bemac

Thanks so much ... This website is amazing because of the help offered by those who know to those who do not ... it is great to be welcomed into the community ...

Very very much appreciated

Paul
Ignored
Your welcome Paul. Hope it helps.
I posted that Variable MA btw in Indicators & Trading Systems Only
  • Trading Discussion
  • /
  • VT Dumb Syntax Questions
  • Reply to Thread
0 traders viewing now
Top of Page
  • Facebook
  • Twitter
About FF
  • Mission
  • Products
  • User Guide
  • Media Kit
  • Blog
  • Contact
FF Products
  • Forums
  • Trades
  • Calendar
  • News
  • Market
  • Brokers
  • Trade Explorer
FF Website
  • Homepage
  • Search
  • Members
  • Report a Bug
Follow FF
  • Facebook
  • Twitter

FF Sister Sites:

  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Forex Factory® is a brand of Fair Economy, Inc.

Terms of Service / ©2021