Add an absolute value to entry price
Author: smurf77
Creation Date: 7/31/2011 1:31 PM
profile picture

smurf77

#1
Hi,

I need some help with this line

CODE:
Please log in to see this code.


I want to sell a share when the price increase for $51.
Example:
Bought a share for $100 and I want to sell it at $151... or same share at $130 and sell it at $181...

Thanks a lot

S
profile picture

Eugene

#2
Hi,

Unless you bought at any price during [bar-1] or Open[bar], selling at limit at "bar" will most likely peek into the future thus leading to inflated results.

What kind of help do you need with this line?
profile picture

smurf77

#3
Thanks Eugene.
I didn't really understand what you meant. Do I have to put bar+1 then?
Either way, it works fine now. I couldn't understand why the results didn't show profit=$51, I forgot to turn off the commission :-d
profile picture

smurf77

#4
Ok I cannot find the result I want. I am translating a backtest from prorealtime to wealthlab.
Since Jan 1st the results on prorealtime for the .SPX are:
75% winning trade when it's a long market and 82% when it's a bear market. I translated all the code now and I don't have the same results...
if you have any suggestions, here is the code:

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

Eugene

#5
After fixing some obvious peeking that I suggested earlier and simplifying the structure, here's my take at it (w/o knowledge of your original rules):
CODE:
Please log in to see this code.
profile picture

smurf77

#6
Thanks a lot!! It looks a lot better!!! you rock!
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).