Hi I used to have this code running and it should just enter a trade at the end of the month in october but for some reason it shows for some year but not all years.
This is all that i am doing. I think it worked fine before I upgraded to 6.4
CODE:
Please log in to see this code.
Size:
Color:
This one will work better:
CODE:
Please log in to see this code.
Size:
Color:
thx. i will try that but how come it worked before ? I can even see in the debug that it says i am entering into a position
Size:
Color:
It printed that to me too but the code's quality leaves something to be desired: hard to read and produces an exception.
Size:
Color:
Would I be able to see the exceptions ? If so where ? the debug does not seem to show it?
Size:
Color:
still does not show all the years.... let me put all the code below
CODE:
Please log in to see this code.
Size:
Color:
You'll see runtime errors in the editor, right below the code area.
Size:
Color:
I dont see the errors. is there some debug i have to turn on ? I see that it compiled and it ran and shows me the debug trace in the debug log
Size:
Color:
QUOTE:
I dont see the errors.
Then there is no runtime error!
QUOTE:
let me put all the code below
Your code formatting makes it almost unreadable, the code contains lots of errors, and won't compile. Just a couple of highlights:
1. You're accessing
Position p=LastPosition before checking for
IsLastPositionActive - a runtime error is just a question of time.
2. "sma" and "smaLonger" should better use SMA.Series instead of calling SMA.Value in the loop which is much slower.
Having said that, it would be really be safer and cleaner if you won't try using what's not required, like calling
GC.Collect - you may trust me on that Wealth-Lab.NET has been doing that since its initial version 5.0.
QUOTE:
still does not show all the years.
Right, it doesn't -- when a month's last date was a holiday and had no trading session.
GetRemainingTradingDays from Community Components (make sure you updated to latest version) is able to do it. The example gives a perfect solution to your question if you type in "0" as the "Remaining Days" parameter.
Size:
Color:
Actually a lot of the code were commented out.. I tried the GetRemainingTradingDays and it works BUT I still don't see all the years triggering a signal. I have cleared out the junk and you should be able to compile this. Can you please run it and see why I only get these years
Position Symbol Quantity Entry Date Entry Price Exit Date Exit Price Profit % Profit $ Bars Held Profit per Bar Entry Name Exit Name MAE % MFE %
Long SPY 2,134 10/29/1993 46.84 11/5/1993 46.06 -1.68 ($1,683.19) 6 ($280.53) pos at C T -2.81 0.33
Long SPY 937 10/30/2009 103.56 11/6/2009 107.13 3.43 $3,329.19 6 $554.86 pos at C T -0.47 3.70
Long SPY 844 10/29/2010 118.49 11/5/2010 122.73 3.56 $3,558.44 6 $593.07 pos at C T -0.55 3.73
Long SPY 777 10/31/2011 125.50 11/7/2011 126.26 0.59 $574.62 6 $95.77 pos at C T -3.18 0.79
CODE:
Please log in to see this code.
Size:
Color:
QUOTE:
***************code below
There's CODE tag, please use that from now on when posting code. It's very easy to click the CODE button, between QUOTE and IMG, and use that to wrap your code around. Thanks.
QUOTE:
Can you please run it and see why I only get these years
Can you please run this in Raw Profit mode in single symbol mode and notice that it takes positions in every October i.e. is 100% working?
CODE:
Please log in to see this code.
Good luck.
Size:
Color:
This is interesting. I used your code and it still does not work BUT as soon as I switched to raw profit mode, it works!!!
Even my original code works too if I am on raw profit mode.. why ?
Size:
Color:
Find 100% of Equity Sizing in the User Guide.
Size:
Color: