Symbol.PipValue returns 0 (GBPUSD)
Symbol.PipValue returns 0 (GBPUSD)
06 Apr 2023, 17:55
Hi,
One of my cBots stopped working due to volume miscalculation (it's running on Pepperstone, Europe - Demo - Hedging - USD).
I tracked the issue down to Symbol.PipValue which appears to be returning 0 at the moment.
This is happening specifically in GBPUSD - not sure if there are other currencies with the same issue.
As far as I can tell something changed between 04-Apr-2023 14:59:59 and 05-Apr-2023 06:00:00. Before 04-Apr-2023 14:59:59 a value was returned but since 05-Apr-2023 06:00:00 0 is returned.
Could you advise if there have been any changes recently that may have caused this or if I've missed something?
Is it safe to use Symbol.PipValue in calculations?
Many thanks
Replies
jonlangdon
09 Apr 2023, 02:40
RE:
PanagiotisChar said:
Hi there,
Please share the cBot code that will allow us to reproduce this behavior so that we can explain what happens.
Need help? Join us on Telegram
Need premium support? Trade with us
Hi Panagiotis,
Thanks for getting back to me - I did reply to this yesterday, but couldn't see my response online yet so wondered if something went wrong when I submitted. Hopefully this is not a repeat...
My code is fairly simple but I have got classes organised separately for reuse, so not easy to paste the whole thing. Hopefully the following will be enough to explain.
I have a class to map bar and symbol values, which I then pass to my strategy ...
protected override void OnBar()
{
var updates = new BarUpdate() {
BarTime = Bars.Last(1).OpenTime,
OpenPrice = Bars.Last(1).Open,
HighPrice = Bars.Last(1).High,
LowPrice = Bars.Last(1).Low,
ClosePrice = Bars.Last(1).Close,
BidPrice = Symbol.Bid,
AskPrice = Symbol.Ask,
PipSize = Symbol.PipSize,
PipValue = Symbol.PipValue,
};
MyStrategy.OnBar(updates);
}
If a trade signal is triggered, I am then using the PipValue in my volume calculation. An example with $100 risk would be:
Volume = ($100 / Stop Loss Pips) / PipValue
I was hoping that by calculating the volume like this, it would be generic and could be used for all currencies/instruments regardless of my account currency.
My main worry is that this approach was working fine until 05-Apr as mentioned above. Since then PipValue has returned 0 and the calculation no longer works. So I was hoping to understand the best approach for this going forward.
Best regards,
Jon
@jonlangdon
PanagiotisChar
10 Apr 2023, 08:04
Hi there,
Unfortunately I cannot tell what happens from a snippet I cannot run. I would need a complete cBot code that I can run and reproduce this behavior.
Need help? Join us on Telegram
Need premium support? Trade with us
@PanagiotisChar
jonlangdon
11 Apr 2023, 16:24
RE:
PanagiotisChar said:
Hi there,
Unfortunately I cannot tell what happens from a snippet I cannot run. I would need a complete cBot code that I can run and reproduce this behavior.
Hi Panagiotis,
Thanks for your reply.
On the most simple level, if you had run the code below on 05-Apr-2023 06:00:00 (I was running this on GBPUSD 1m - Pepperstone, Europe - Demo - Hedging - USD), PipValue returned 0.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
namespace cAlgo.Robots
{
[Robot(AccessRights = AccessRights.None)]
public class rtExample : Robot
{
protected override void OnStart()
{
}
protected override void OnBar()
{
Print("Pip Value: ", Symbol.PipValue);
}
}
}
This appears to have since been fixed and pip value returns correctly now (I don't know exactly when it was fix but PipValue returned 0 for a few days). Really, I just want to know:
Were you aware of there being any issues in this regard?
Was this only an issue on Demo accounts?
Is there any chance of this happening going forward - is PipValue the correct/reliable value to use in my volume calculations?
Best regards,
Jon
@jonlangdon
PanagiotisChar
12 Apr 2023, 07:46
Hi there,
I am not aware of any issues as I do not work for Pepperstone or Spotware. I was just trying to help.
Need help? Join us on Telegram
Need premium support? Trade with us
@PanagiotisChar
jonlangdon
13 Apr 2023, 01:17
RE:
PanagiotisChar said:
Hi there,
I am not aware of any issues as I do not work for Pepperstone or Spotware. I was just trying to help.
Hi Panagiotis,
I see, apologies for that - still finding my way around the setup here.
I must admit I did have it in my head that you were perhaps connected to Spotware - I think it's because I've seen your name come up so often since I've been looking around the Forum!
I don't suppose you would know what route, if any, I could follow to get an answer to the sort of question I had?
You're help is much appreciated!
Best regards,
Jon
@jonlangdon
PanagiotisChar
07 Apr 2023, 09:08
Hi there,
Please share the cBot code that will allow us to reproduce this behavior so that we can explain what happens.
Aieden Technologies
Need help? Join us on Telegram
Need premium support? Trade with us
@PanagiotisChar