Information
Username: | ThePhantomRaven |
Member since: | 19 May 2014 |
Last login: | 19 May 2014 |
Status: | Active |
Activity
Where | Created | Comments |
---|---|---|
Algorithms | 0 | 8 |
Forum Topics | 0 | 0 |
Jobs | 0 | 0 |
Last Algorithm Comments
I'm sorry my mistake again.
I just realized long stop order script places a market order not pending order so original script was correct.
Which means the mistake is on the short limit mode.
//Limit Mode
if (Symbol.Bid >= _ShortPrice && _ShortLX == 0 && _SCurrentTries < _MaxTries && !_LModeS)
Symbol bid should be smaller than short start level for limit order.
Maybe this explains the bug I experienced where the bot placed multiple sell orders all at once where current price was higher than the sell start price.
Is there way to delete my past post because it is getting confusing.
My mistake about the post.
190 //Execute Order - Limit Mode
191 if (Symbol.Ask >= _LongPrice && _LongLX == 0 && _LCurrentTries < _MaxTries && _LModeL)
I think that should be (Symbol.Ask <= _LongPrice
but I think
//Execute Order - First the Stop Mode
if (Symbol.Ask >= _LongPrice && _LongX == 0 && _LCurrentTries < _MaxTries && !_LModeL)
should be (Symbol.Ask <= _LongPrice
Another problem (not a bug with the bot but how the pending order works) is when the order is placed and the spread becomes bigger than the stop loss during news release, order will be placed without stop loss.
I think there is a code where if the current opened position is bigger than certain pips then the order will be closed.
But I am very new to programming so I don't know how to apply it to your bot.
I will post the code if I figure it out.
Something like this
protected override void OnTick()
foreach (var position in Positions)
{
if (position.Pips < SLoss)
{
ClosePosition(position);
190 //Execute Order - Limit Mode
191 if (Symbol.Ask >= _LongPrice && _LongLX == 0 && _LCurrentTries < _MaxTries && _LModeL)
I think that should be (Symbol.Ask <= _LongPrice
There is also a bug where it repeatedly places all the orders up to specified number in Max orders.
This happened when I placed Stop orders for both buy and sell together at the same time.
Sell stop was placed about 50 pips below, but it activated at the current price.
At the time I have set the max orders to 5 times and all 5 was placed at once.
This is very useful and simplest indicator ever for scalpers.
Nice idea.
And the last part of that line
//Limit Mode
if (Symbol.Bid <= _ShortPrice && _ShortLX == 0 && _SCurrentTries < _MaxTries && !_LModeS)
Should not contain !.
I think this is the cause of bug where multiple sell orders are placed at once. Because if price was higher than sell start level the limit mode would be false, thus resulting in all the limit orders executing at once.