dear MC support,
when I check and print out PosTradeProfit(1,0) / PosTradeExitPrice(1,0) / PosTradeEntryPrice(1,0)....all are zero. anything I am doing incorrectly?
brgds
YT
print out PosTradeProfit / PosTradeExitPrice / PosTradeEntryPrice....all are zero.
- Angelina MultiСharts
- Posts: 260
- Joined: 28 Dec 2016
- Has thanked: 28 times
- Been thanked: 66 times
Re: print out PosTradeProfit / PosTradeExitPrice / PosTradeEntryPrice....all are zero.
Hello kiyi0317,
I've tried running the following script with 1 Day MSFT Free Quotes chart:
Output shows non-zero values - please see the screenshot attached.
Can you please describe your setup in more details?
I've tried running the following script with 1 Day MSFT Free Quotes chart:
Code: Select all
once cleardebug;
if currentbar = 1 then buy next bar at market;
if currentbar = 5 then sell next bar at market;
if PosTradeCount(1) >= 1 then
print( PosTradeProfit(1,0), " ", PosTradeExitPrice(1,0), " ", PosTradeEntryPrice(1,0));
Can you please describe your setup in more details?
- Attachments
-
- PosTradeProfit.PNG
- (115.62 KiB) Downloaded 953 times
Re: print out PosTradeProfit / PosTradeExitPrice / PosTradeEntryPrice....all are zero.
hi Angelina,
The signal can being work perfectly. and then I added above code at the end of signal, but it just printing out zero as below screen cap. I could not found where is the mistake, pls adv.
range bar has being used and [SameExitFromOneEntryOnce = False];
any more details needed?
thanks
Code: Select all
print(date,time,close of data1,postradeprofit(1,0),postradeprofit(2,0));
range bar has being used and [SameExitFromOneEntryOnce = False];
any more details needed?
thanks
- Attachments
-
- ScreenHunter_391 Feb. 07 09.16.jpg
- (57.5 KiB) Downloaded 944 times
- Angelina MultiСharts
- Posts: 260
- Joined: 28 Dec 2016
- Has thanked: 28 times
- Been thanked: 66 times
Re: print out PosTradeProfit / PosTradeExitPrice / PosTradeEntryPrice....all are zero.
PLease replace your print statement with this one:
After that please run your signal and attach a screenshot of the output log.
Code: Select all
Print(datetimetostring(datetime), " Completed trades: ", totaltrades, " Open entries:", CurrentEntries);
if PosTradeCount(1) >= 1 then
Print("BGP=", bigpointvalue:10:5, " TP=",PosTradeProfit(1,0):10:5, PosTradeEntryPrice(1,0):10:5, PosTradeExitPrice(1,0):10:5);
Re: print out PosTradeProfit / PosTradeExitPrice / PosTradeEntryPrice....all are zero.
Angelina, thank you
see below screen cap, the first picture seems workable. but once I closed the MC and re-start the MC, the history record was gone. (see the second one)
is it all right on picture one?
how can I get the postradeprofit(1,0) when I open the MC every morning?
see below screen cap, the first picture seems workable. but once I closed the MC and re-start the MC, the history record was gone. (see the second one)
is it all right on picture one?
how can I get the postradeprofit(1,0) when I open the MC every morning?
- Attachments
-
- ScreenHunter_395 Feb. 08 16.19.jpg
- (78.17 KiB) Downloaded 924 times
-
- ScreenHunter_396 Feb. 08 16.24.jpg
- (57.88 KiB) Downloaded 924 times
- Angelina MultiСharts
- Posts: 260
- Joined: 28 Dec 2016
- Has thanked: 28 times
- Been thanked: 66 times
Re: print out PosTradeProfit / PosTradeExitPrice / PosTradeEntryPrice....all are zero.
kiyi0317,
In second case, as you can see there are no completed trades, so no Profit, Exit/Entry Prices to print out.
In second case, as you can see there are no completed trades, so no Profit, Exit/Entry Prices to print out.
Re: print out PosTradeProfit / PosTradeExitPrice / PosTradeEntryPrice....all are zero.
sorry, it does not make sense to me. Postradeprofit(1,0) is looking for the latest closed. why it was disappear when I close the MC and re-start? is it any problem with my script?
Re: print out PosTradeProfit / PosTradeExitPrice / PosTradeEntryPrice....all are zero.
dear all,sorry, it does not make sense to me. Postradeprofit(1,0) is looking for the latest closed. why it was disappear when I close the MC and re-start? is it any problem with my script?
any one can have some comments?
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: print out PosTradeProfit / PosTradeExitPrice / PosTradeEntryPrice....all are zero.
There may not be enough information in this thread to give a decisive answer:dear all,sorry, it does not make sense to me. Postradeprofit(1,0) is looking for the latest closed. why it was disappear when I close the MC and re-start? is it any problem with my script?
any one can have some comments?
- If you're doing a backtest on historical data and there is more than one closed position, then `PosTradeProfit(1, 0)` should return a value.
- If you're auto trading on real time data with auto trading just turned on, it's quite likely that `PosTradeProfit(1, 0)` returns 0 even though you did trades in the past. That's because the MultiCharts strategy typically assumes everything is flat, and so when it just starts trading it will not take previous positions (as well as previous orders and pending orders) into consideration. So with that case it makes sense that `PosTradeProfit(1, 0)` returns 0 too. Because as far as the strategy is concerned, there were no previous positions.
Re: print out PosTradeProfit / PosTradeExitPrice / PosTradeEntryPrice....all are zero.
hi Josh,
thanks, I believe that is the answer. Hope that it would be happen in future to consider to have an option for counting the previous trade records.
brgds
Chan
thanks, I believe that is the answer. Hope that it would be happen in future to consider to have an option for counting the previous trade records.
brgds
Chan