I tried to assign position priority to my strategy like in the example in the user guide. I'm facing trouble passing the priority value as the signalName parameter in the entry signal to use it for trading. I always get errors when compiling. Could you help me coding this?
CODE:
Please log in to see this code.
Size:
Color:
The script compiles fine for me, but technically, the priority shouldn't be set for the LastPosition unless you're absolutely sure that you've created a position (as shown in the QuickRef) ;
CODE:
Please log in to see this code.
What's the point of using priority for the entry signal? You won't be able to use fixed exit logic that looks for a specific RSI value, if that's the intention. Otherwise, explain what the goal is.
Size:
Color:
The point is to have a priority when more trade alerts are created then there is buying power for all trades.
Size:
Color:
What else can I do to assign priority and sort the trade alerts when too much alerts are created?
Size:
Color:
Okay, so you want the priority in the signal name in order to sort the Alerts. That's fine. Then you just have to remove the if (p.EntrySignal.Contains("Group1|")) statement so that the exit logic can trigger .
Size:
Color:
Thanks, Cone
Size:
Color:
I am having a hard time assigning priority to the following system. I have a system that is very similar but it runs with Priority. Both systems compile without error. Is there anything that I'm missing? Thanks.
System that won't run:
CODE:
Please log in to see this code.
System that runs:
CODE:
Please log in to see this code.
Size:
Color:
How many more times do I have to answer this question? I already showed you how to assign Position.Priority to the very same code (post #10), you understood (see your own follow-up post #12), and now you again don't?
Trade name based on indicator valueLet me know that you've read it and I'll delete the duplicate question. And I'd appreciate if for requesting minor modifications of this code you'd reuse
that (original) thread. Thanks.
Size:
Color:
It was a simple fix. I has SellAtMarket(bar + 1, p, Bars.FormalValue(atrp[bar])) , when I should have had p1. Same careless mistake. Sorry:(
Size:
Color:
That does not fix the Position.Priority assignment.
Size:
Color:
I thought it did. Could you provide further explanation?
Size:
Color:
Position.Priority is assigned at the time of its creation, not exit. Whatever you fixed with the SellAtMarket did not apply. Re-examine your own code referenced in my post #8 above.
Size:
Color:
I'm not sure how I didn't assign Position.Priority at time of creation. Having looked at example in post #8 and I'm still unclear what you are instructing me to do.
Please look at the code below . Am I not assigning Position.Priority here?:
CODE:
Please log in to see this code.
Size:
Color:
You are but it's not entirely correct. If you carefully re-examine the QuickRef example for Position.Priority or your own code referenced in my post #8, you'll see what you're missing. Specifically, if a Position wasn't created due to insufficient capital, you will still attempt the property assignment for LastActivePosition which may cause a runtime error.
Size:
Color:
Does that mean I should write if position.priority is not null then LastActivePosition.Priority = ATRP.Series(Bars,4)[bar];
Size:
Color:
Almost. Only set Position Priority if the trading signal returns a Position (i.e., NOT null)... like the example....
CODE:
Please log in to see this code.
Size:
Color:
I see, Thanks Robert. I'll try that.
Actually, Looking back I had that commented out.
CODE:
Please log in to see this code.
Removing that comment actually prevents the program fro running. Is the order incorrect or should I exclude one of these lines of code? When I run the program with this line commented out the program does run and shows up as expected as position name on the Trades tab.
I was able to demonstrate what Eugene stated in #14 by starting with $500 starting capitol creating a run time error. So I guess at this point I am hung up on the syntax.
EDITDisregard the attachment
EDITI believe this is correct. No runtime error with $100 starting capitol.
CODE:
Please log in to see this code.
Size:
Color: