# Rita trades triggade av Webhook i Tradingview

Till er som använder AlgoPal Webhook till TradingView så är här en tweak till webhook\_tradingview\_trigger.bat som gör att alla köp/sälj man triggar via Webook sparas som en lite kod-snutt i separata filer per (Fält24), som man sen kan lägga in koden i Pinescript för att analysera sina trades i TradingView-diagrammet.

För att plotta trade i Tradingview:\
\
Editerar fil där trades blivit loggade (ligger i AutotraderBas-mappen) och kopierar in koden i Pinescript.

Obs! Lägg till 2 rader som start av koden i Pinehanteraren:

//@version=5

strategy(title='Trading History', shorttitle='TH', overlay=true)

<figure><img src="/files/B6Shj2IFT7AHkC5fc1Vj" alt=""><figcaption></figcaption></figure>

För att skapa filer med trade-history, \
Editera file, webhook\_tradingview\_trigger.bat och lägg in denna kod mellan,\
\
move /Y "%TempFile%" "%FileName%" \
\
\&#xNAN;**\[kod nedan]** \
\
:EndBatch endlocal\
\
\
**Kod**

```
set yr=%DATE:~0,4%
set mon=%DATE:~5,2%
set day=%DATE:~8,2%
set TIMEFULL=%TIME: =0%
set hour=%TIMEFULL:~0,2%
set min=%TIMEFULL:~3,2%
set sec=%TIMEFULL:~6,2%

IF %2==0 (
set trade=Stop
set style=shape.cross
set color=color.orange
)

IF %2 gtr 0 (
set trade=Long
set style=shape.triangleup
set color=color.green
)

IF %2 lss 0 (
set trade=Short
set style=shape.triangledown
set color=color.red
)

ECHO float d%yr%%mon%%day%%hour%%min%%sec% = na >>"Trades_%1.txt"
ECHO barTime%yr%%mon%%day%%hour%%min%%sec% = time_close[1] >>"Trades_%1.txt"
ECHO next_barTime%yr%%mon%%day%%hour%%min%%sec% = time_close >>"Trades_%1.txt"
ECHO tradeTime%yr%%mon%%day%%hour%%min%%sec% = timestamp("GMT+1", %yr%, %mon%, %day%, %hour%, %min%, %sec%) >>"Trades_%1.txt"
ECHO d%yr%%mon%%day%%hour%%min%%sec% ^:^= tradeTime%yr%%mon%%day%%hour%%min%%sec% ^> barTime%yr%%mon%%day%%hour%%min%%sec% and tradeTime%yr%%mon%%day%%hour%%min%%sec% ^< next_barTime%yr%%mon%%day%%hour%%min%%sec% ^? tradeTime%yr%%mon%%day%%hour%%min%%sec% ^: na >>"Trades_%1.txt"
ECHO plotshape(d%yr%%mon%%day%%hour%%min%%sec%, title="%trade%", text="%trade%", location=location.abovebar, style=%style%, size=size.tiny, textcolor = %color%, color=%color%) >>"Trades_%1.txt"
ECHO: >>"Trades_%1.txt"
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wiki.algopal.com/autotrader/tips-och-trix/rita-trades-triggade-av-webhook-i-tradingview.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
