QQQQ Crash Strategy: replace Timed Exit with Trailing Stop
Author: zozzy
Creation Date: 6/26/2015 1:02 PM
profile picture

zozzy

#1
I'm trying to make a minor modification to the QQQQ Crash script. I just want to replace the Timed Exit with a Trailing Stop. I got the code for the Trailing Stop form a Rules example. My modified version almost compiles but gives me 3 error messages. Would you please take a look at it tell me what I'm doing wrong? Code below. Thanks.

CODE:
Please log in to see this code.


profile picture

Eugene

#2
Hi,

Unfortunately, simply cutting and pasting seldom works. To avoid these errors you need to understand how the code works. A good selection of tutorials from this FAQ could help learn the theory: How do I start with C# ?

1. This block of code is missing a set of curly braces:

CODE:
Please log in to see this code.


Simply wrap it in a set of curly braces.


2. Next, as the "p" wasn't defined all references to "p." (its properties) created by the Rule Wizard are defunct in this strategy. You can change this line accordingly as it's easier than changing all the references:

CODE:
Please log in to see this code.

Hence, rename the Pos to p.


3. Finally, the " quotation marks - they should be changed to the one recognized by the compiler:
CODE:
Please log in to see this code.

I don't know how you managed to type that character in the WL Editor because mine is thrown off by them. A text editor perhaps?
profile picture

zozzy

#3
Eugene,

I added a set of curly brackets around the section of code you indicated. But I still get the same 3 error messages on these 2 lines:

If (p.EntrySignal.Contains("BBuy") error CS1010@(39,33) : Newline in constant
...and...
BuyAtMarket (bar + 1, "BBuy"); error CS1056@(51,28) : Unexpected character "
error CS1010@(51,33) : Newline in constant
profile picture

zozzy

#4
Thank you, Eugene,

It compiles and runs fine now. Although, I'm not sure it's an improvement over the original version.
You were right. I did copy and paste from WORD. Apparently not a good idea.

I appreciate your help.

Bob