Trade name based on indicator value
Author: mikesblack
Creation Date: 1/11/2016 2:24 PM
profile picture

mikesblack

#1
I want to be able to reference the trades page to make decisions related to position size. I wrote this system using drag and drop and changed it to system via the editor. Below is the code for the entry.
I am only seeing open trades and not all trades run through a back test.

Two questions I have are, what will I need to write to allow some indicator write that value and then also shows all open and closed trades in the trades window and is there a way to do this using drag and drop?

Please let me know if you have any further questions.

TIA,
Mike
CODE:
Please log in to see this code.


profile picture

Eugene

#2
QUOTE:
is there a way to do this using drag and drop?

No.

QUOTE:
allow some indicator write that value

You're already doing it but instead of ToString("00.00"), you might want to consider using Bars.FormatValue (QuickRef for more).

QUOTE:
I am only seeing open trades and not all trades run through a back test.

Maybe load enough data?
profile picture

mikesblack

#3
Thanks Eugene, I'll work on it.
profile picture

mikesblack

#4
Eugene,

Can you help me with syntax? I'm still just seeing Group1| for the entry name.

Thanks.

CODE:
Please log in to see this code.


As it is, not working.
profile picture

Eugene

#5
Well, you overlooked what the QuickRef suggests:

string FormatValue(double value);

Here's an example for you:
CODE:
Please log in to see this code.
profile picture

mikesblack

#6
Thanks Eugene. I'll work on it.
profile picture

mikesblack

#7
Great! Got it to work. Thanks again.
profile picture

mikesblack

#8
Eugene,

Now I wish to create a priority for the buy. Below is the code I have. If you don't mind, can you help me with this. BTW: My apologies for the multiple posts in such a short time. I'll try to limit this.

Mike

CODE:
Please log in to see this code.
profile picture

mikesblack

#9
There is one issue that hasn't been resolved. Aside from creating priority, when I run this program, the second condition to sell isn't functioning as I am showing trades that are up to 169 bars. The second condition is a time based sell, to exit after 6 bars. Why isn't that condition being recognized? What will I need to do?

Many thanks!
profile picture

Eugene

#10
QUOTE:
Now I wish to create a priority for the buy. Below is the code I have.

No need to reinvent the wheel. The QuickRef has a working example. If you followed it precisely you'd have (on the fly coding)...
CODE:
Please log in to see this code.

As an alternative, a Position could have been explicitly created (but not necessary):

CODE:
Please log in to see this code.


QUOTE:
Why isn't that condition being recognized?

The value at entry bar is different from the current bar. Comment this out:
CODE:
Please log in to see this code.

profile picture

mikesblack

#11
Thank you very much Eugene. I'll get to work.
profile picture

mikesblack

#12
Eugene, still no luck. I'm not sure if I am following your advice correctly.

CODE:
Please log in to see this code.
profile picture

Eugene

#13
Mike,

Did you know that books on programming contained intentional typos to spur student's attention? There is an (unintentional) light syntax error in my on-the-fly code line. You shouldn't give up so easy!

I notice that earlier in this thread you already posted a code which had live syntax errors. Relying on my help is not the right approach. As you're not a newbie, you should be able to easily fix such minor error with Wealth-Lab compiler's guidance. Note what the error log is telling you. There's error code and a line number. This is enough to look the error code up in MSDN, understand what it is telling you, figure out what statement on which line is affected, check out the QuickRef for the correct syntax, compare and fix it.

Let this be an excercise which you should be able to crack in no time after 3 terms in C#. Good luck!
profile picture

mikesblack

#14
LOL! It would be better to work out the problem on my own for sure. At this point I am trying to understand C# through WL and not through Visual Studio. I have a general understand on for example, how to write methods, override methods, generate new classes , inherit from them and instantiate new objects.I understand arrays,lists, looping structures as per this example a for loop.

All that said at this point,blending what I know from class with the WL is hard for me. I don't want to get into the habit of constantly asking for your help when ever I encounter a fairly easy topic. What I will need is learning to become comfortable with the WL environment as well as the reference manuals, this site as well as the WIKI. As WL is a fairly specialized program, finding external sources on You Tube or Lynda.Com may be hard. We'll see if I can get some sessions with my professor. That may be beyond the scope of her responsibilities, but I guess it doesn't hurt to ask. By the way, my professor, Mari Good is a Fidelity consultant.I'm not sure what she covers.

So, I will continue to try and work through my problems. I don't want to become a pain to you. Thanks for your encouragement as well as your support.
profile picture

mikesblack

#15
Figured it out! :)
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).