Edit Your Comment
LSMA
Nov 14, 2010 at 11:54
เป็นสมาชิกตั้งแต่ Oct 09, 2010
3 โพสต์
Hey all chasing some help with the LSMA in color and its coding. Using an expert advisor builder and i add a variable (i.e LSMA in color) and choose one line to analyse, lets say green for the purpose of this example.
What i am unsure about it how to code the buy strategy. Basically i want to buy when the line equals green. As i am unsure about what it returns when line equals green this is where I'm struggling. Thoughts on how to go about this?
I've tried:
BUY when LSMA (green line) = 1
Thanks in advance
Dez
What i am unsure about it how to code the buy strategy. Basically i want to buy when the line equals green. As i am unsure about what it returns when line equals green this is where I'm struggling. Thoughts on how to go about this?
I've tried:
BUY when LSMA (green line) = 1
Thanks in advance
Dez
เป็นสมาชิกตั้งแต่ Oct 28, 2009
1409 โพสต์
Nov 15, 2010 at 12:00
(แก้ไขแล้ว Nov 15, 2010 at 12:02)
เป็นสมาชิกตั้งแต่ Oct 28, 2009
1409 โพสต์
If it's the kind of indicator I'm thinking of you would use something like this.
double LSMAGreen = iCustom(NULL, 0, "LSMA", Period, Method, Price, 0, 0, 1);
double LSMARed = iCustom(NULL, 0, "LSMA", Period, Method, Price, 0, 1, 1);
string Direction "None";
if(LSMAGreen != EMPTY_VALUE) Direction "Long";
if(LSMARed != EMPTY_VALUE) Direction "Short";
You could then open a sell if Direction Short or a long if Direction Long
Where it says LSMA in the iCustom function it need to be the exact name of the indicator.
You then need to provide values for all the values that can be set for the indicator.
I've assumed you have Period, Method and Price. These can be defined either as extern variables or hard coded into the lines.
I've set this to wait for a bar to finish painting as if it's the indicator I'm thinking of it repaints.
double LSMAGreen = iCustom(NULL, 0, "LSMA", Period, Method, Price, 0, 0, 1);
double LSMARed = iCustom(NULL, 0, "LSMA", Period, Method, Price, 0, 1, 1);
string Direction "None";
if(LSMAGreen != EMPTY_VALUE) Direction "Long";
if(LSMARed != EMPTY_VALUE) Direction "Short";
You could then open a sell if Direction Short or a long if Direction Long
Where it says LSMA in the iCustom function it need to be the exact name of the indicator.
You then need to provide values for all the values that can be set for the indicator.
I've assumed you have Period, Method and Price. These can be defined either as extern variables or hard coded into the lines.
I've set this to wait for a bar to finish painting as if it's the indicator I'm thinking of it repaints.
11:15, restate my assumptions: 1. Mathematics is the language of nature. 2. Everything around us can be represented and understood through numbers. 3. If you graph these numbers, patterns emerge. Therefore: There are patterns everywhere in nature.
Nov 15, 2010 at 13:48
เป็นสมาชิกตั้งแต่ Oct 09, 2010
3 โพสต์
double index1 = iCustom(NULL, 0, "LSMA in Color", 34, 1500, 1, Current + 0);
double index2 = iCustom(NULL, 0, "LSMA in Color", 34, 1500, 0, Current + 0);
double index3 = iCustom(NULL, 0, "LSMA in Color", 34, 1500, 2, Current + 0);
double Buy1_1 = iCustom(NULL, 0, "LSMA in Color", 34, 1500, 1, Current + 0);
double Buy1_2 = index1 ;
double CloseBuy1_1 = index1 ;
double CloseBuy1_2 = index2 ;
Its not able to identify the color still 😞
Any thoughts?
double index2 = iCustom(NULL, 0, "LSMA in Color", 34, 1500, 0, Current + 0);
double index3 = iCustom(NULL, 0, "LSMA in Color", 34, 1500, 2, Current + 0);
double Buy1_1 = iCustom(NULL, 0, "LSMA in Color", 34, 1500, 1, Current + 0);
double Buy1_2 = index1 ;
double CloseBuy1_1 = index1 ;
double CloseBuy1_2 = index2 ;
Its not able to identify the color still 😞
Any thoughts?
เป็นสมาชิกตั้งแต่ Oct 28, 2009
1409 โพสต์
Nov 15, 2010 at 13:53
เป็นสมาชิกตั้งแต่ Oct 28, 2009
1409 โพสต์
You need to add some Comment lines into your code to display on screen the value of your variables in order to debug it.
11:15, restate my assumptions: 1. Mathematics is the language of nature. 2. Everything around us can be represented and understood through numbers. 3. If you graph these numbers, patterns emerge. Therefore: There are patterns everywhere in nature.

*การใช้งานเชิงพาณิชย์และสแปมจะไม่ได้รับการยอมรับ และอาจส่งผลให้บัญชีถูกยกเลิก
เคล็ดลับ: การโพสต์รูปภาพ/youtube url จะฝังลงในโพสต์ของคุณโดยอัตโนมัติ!
เคล็ดลับ: พิมพ์เครื่องหมาย @ เพื่อป้อนชื่อผู้ใช้ที่เข้าร่วมการสนทนานี้โดยอัตโนมัติ